Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To schedule a command on a Linux VPS, place five time fields followed by the command in a user crontab: minute hour day-of-month month day-of-week command. For example, */5 * * * * /bin/sh /opt/test.sh runs a script every five minutes. You edit that table with crontab -e, verify it with crontab -l, and should use absolute paths plus explicit logging so the job behaves predictably without an interactive shell.

What cron and crontab do on a VPS

cron is the scheduler daemon; a crontab is the table of schedules it reads. Each user can have a personal crontab, and the daemon checks the entries as time advances. When an entry matches the current date and time, cron starts the command with the permissions of the crontab owner.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This is useful for recurring, unattended work such as backups, report generation, cache cleanup, certificate checks, or maintenance scripts. A VPS job does not run inside your SSH session, so it has a different environment: there is no interactive terminal, aliases may not exist, and the working directory is not the directory you happened to be in when you saved the file.

The five-field crontab syntax

A normal user crontab line has this order:

Field Allowed values Meaning
Minute 0–59 Minute within the hour
Hour 0–23 Hour in 24-hour notation
Day of month 1–31 Calendar day
Month 1–12 or jan–dec Calendar month
Day of week 0–7 or sun–sat Weekday; Sunday is both 0 and 7

The fields are separated by spaces or tabs. The command starts after the fifth field and continues to the end of the line. Asterisks mean “every value” in that field.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Reading a line from left to right

In 30 2 * * *, 30 is minute 30, 2 is 02:00, and each asterisk allows every day of the month, every month, and every weekday. Add a command to make a complete entry:

30 2 * * * /usr/local/bin/nightly-backup

This requests a run at 02:30 every day. The schedule uses the VPS host’s local time zone, so confirm the server’s clock and time-zone configuration before relying on a business-hour schedule.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operators: wildcards, lists, ranges and steps

Each time field accepts combinations of four basic forms.

  • Wildcard (*): every value. * in the hour field allows every hour.
  • List (,): selected values. 20,40 in the minute field runs at minutes 20 and 40.
  • Range (-): an inclusive span. 1-10 means values 1 through 10; names such as mon-wed and jan-mar can be used where supported by the field.
  • Step (/): every specified interval across a field or range. */30 in the minute field means minute 0 and 30 of each hour.

These forms can be combined. 0-30/10 in the minute field selects 0, 10, 20 and 30. A list such as 9-17,20 is read as all values from 9 through 17 plus 20; keep complex expressions readable by using comments on their own lines.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

The day-of-month and day-of-week rule

The two day fields have a behavior that surprises many administrators. If both day-of-month and day-of-week are restricted (neither is *), cron runs the command when either field matches, not only when both match.

For example:

30 4 1,15 * 5 /usr/local/bin/report

This runs at 04:30 on the 1st and 15th of the month and on every Friday. To express “only when both conditions are true,” put the logic in a wrapper script that checks the date, or use a schedule design that leaves one day field as * and performs the additional test in the command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical cron schedules for a Linux VPS

Goal Crontab entry What it does
Every five minutes */5 * * * * /bin/sh /opt/test.sh >> /var/log/test.log 2>&1 Runs at five-minute intervals and appends standard output and errors to a log.
Daily at 10:00 0 10 * * * /bin/sh /opt/test.sh Runs at 10:00 every day.
Hourly from 10:00 through 18:00 0 10-18 * * * /bin/sh /opt/test.sh Runs on the hour at 10:00, 11:00, through 18:00.
Sundays at 22:00 0 22 * * 0 /usr/bin/apt-get update Runs when the day-of-week value is Sunday (0; 7 is also Sunday).
At midnight daily 0 0 * * * /usr/local/bin/cleanup Runs at 00:00 each day.

The paths in these examples are intentional. Cron’s default PATH can be minimal, and a script that works interactively as python, node, or apt-get may fail when cron cannot locate that executable. Use the full path (find it with command -v program in your shell) or define a suitable PATH in the crontab.

Special strings for common schedules

Eight shortcuts replace all five time fields:

String Equivalent schedule
@reboot Run once when the cron service starts the user’s jobs after system startup.
@yearly or @annually 0 0 1 1 * — midnight on January 1.
@monthly 0 0 1 * * — midnight on the first day of each month.
@weekly 0 0 * * 0 — midnight at the start of Sunday.
@daily or @midnight 0 0 * * * — midnight every day.
@hourly 0 * * * * — the start of every hour.

For example:

@daily /usr/local/bin/rotate-reports

@reboot is not a guarantee that every service is already ready. The Ubuntu crontab documentation notes that startup, for this purpose, can occur before some system daemons or other facilities have started. If your script depends on a network mount, database, or another service, make the script wait and retry, or choose a service manager with explicit dependency handling.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Editing and managing a user’s crontab

Use the account that should own and run the job. On a VPS, that distinction matters: a root crontab can change the whole system, while an application account usually has safer, narrower permissions.

  1. Open the editor: run crontab -e. On the first run, the system may ask you to select an editor.
  2. Add one complete line: enter the five fields, command path, and any redirection. Put a comment on a separate line if you need to document the schedule.
  3. Save and exit: the crontab command validates and installs the file when the editor closes.
  4. Verify the installed table: run crontab -l and check spacing, paths, and the account shown by your shell prompt.

To manage another user’s table, an administrator can specify -u user, for example sudo crontab -u appuser -e or sudo crontab -u appuser -l. crontab -r removes the current user’s entire crontab; use it carefully because it does not remove just one selected line.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Comments, variables and the non-interactive environment

Blank lines and leading spaces or tabs are ignored. A line whose first non-space character is # is a comment. Keep comments on their own lines: an inline comment after a command is a known portability trap because the comment text can become part of the command rather than being discarded.

You can set environment variables before scheduled entries using NAME=value; spaces around the equals sign are optional. A practical header might look like this:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO=admin@example.net

# Run the import at 03:15 every day
15 3 * * * /usr/local/bin/import-data

The documented defaults include SHELL=/bin/sh; LOGNAME and HOME come from the crontab owner’s password entry. If your script expects Bash features, call Bash explicitly (for example, /bin/bash /opt/job.sh) instead of assuming that /bin/sh is Bash. Likewise, use absolute paths for files because the job’s current directory is not a dependable project directory.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Capturing output and diagnosing failures

Cron may mail command output when local mail is configured. Setting MAILTO makes the intended recipient explicit; an empty value, MAILTO=, disables mail for entries below it. For VPS operations, a logfile is usually easier to inspect:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
*/5 * * * * /usr/local/bin/health-check >> /var/log/health-check.log 2>&1

>> appends standard output, while 2>&1 sends standard error to the same destination. Ensure the crontab owner can write the directory and file; a root-owned log path will fail for an unprivileged account. Rotate growing logs so a frequent job does not consume the VPS disk.

When a job never runs

  • Run crontab -l as the expected account and confirm the line is installed.
  • Check each field against the server’s actual local time and time zone. Remember that the hour field is 0–23.
  • Execute the exact command manually with its full paths. Fix permissions, interpreter paths, missing environment variables, and working-directory assumptions.
  • Inspect the redirected logfile or local cron/system logs for a permission, syntax, or “command not found” error.
  • Temporarily schedule a harmless test every five minutes, such as writing the date to a file, then remove it after verification.

When it runs more or less often than expected

Look for a step expression that includes minute 0, and check whether both day fields are restricted: the OR rule can add Fridays (or another weekday) to the dates you listed. A daylight-saving transition can also create a skipped or repeated local clock time; avoid ambiguous times for critical work and make the command safe to run twice.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

User crontab versus the system-wide crontab

A personal crontab contains five time fields followed directly by the command. System-wide files such as /etc/crontab insert a user field between day-of-week and command:

M H DOM MON DOW USER COMMAND

For example, the system-wide form must identify which account should execute the command; copying that line into crontab -e would shift the fields and produce an incorrect schedule. System-wide files are appropriate when an administrator owns the schedule, while a user’s crontab avoids granting unnecessary privileges.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choosing cron or another scheduler

Cron is compact and widely available, making it a good fit for straightforward recurring commands. Systemd timers are a commonly cited alternative when you need service dependencies, explicit unit configuration, or persistence behavior for jobs that were missed while a machine was powered off. Their syntax and operational model differ, so treat a migration as a separate design decision rather than translating fields mechanically. Whichever scheduler you use, make the task idempotent, log its result, and define what should happen after a failure.

A safe deployment checklist

  • Confirm the VPS time zone and the account that should run the task.
  • Write the five fields in minute, hour, day-of-month, month, day-of-week order.
  • Use lists, ranges, and steps deliberately; test a complex expression on paper.
  • Use absolute paths to interpreters, scripts, input files, and output files.
  • Set required variables such as PATH, SHELL, or application configuration explicitly.
  • Redirect output to a writable, rotated logfile or configure MAILTO.
  • Test the exact command manually, then install with crontab -e.
  • Verify with crontab -l, observe one run, and remove temporary test entries.
  • Review permissions and avoid putting secrets directly in a world-readable script or command line.

Quick reference

Task Command or pattern
Edit current user’s jobs crontab -e
List current user’s jobs crontab -l
Remove current user’s entire table crontab -r
Edit another user’s jobs (administrator) crontab -u user -e
Every five minutes */5 * * * * command
Every day at midnight 0 0 * * * or @daily
At startup @reboot command

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.