Skip to main content
Cron is the classic Unix job scheduler: give it a schedule and a command, and it runs that command for you forever. Backups, log cleanup, hourly syncs, nightly reboots — anything you can put in a shell command, cron can put on a timer.

Edit your crontab

Each user has their own crontab. Run this as the user you want the job to run as:
The first time, you will be asked to pick an editor. nano is the easiest choice.

Cron schedule syntax

Each line has five time fields followed by the command to run:

Example jobs

When writing schedules by hand, crontab.guru is invaluable for double-checking.

List, view, and remove

Common pitfalls

  • Cron has a minimal PATH. Always use absolute paths (/usr/bin/python3, not just python3) or set PATH= at the top of your crontab.
  • Cron does not load your shell profile. Environment variables from ~/.bashrc are not available. Set them explicitly in the crontab or inside the script.
  • Output is emailed by default. On a VPS without mail configured, this fails silently. Redirect output to a log file so you can debug:

Check that cron is running

If it is stopped, start it and see systemd Services.