Home / Configs / Servers / crontab examples

crontab examples: schedule a script to run automatically

Run a script every minute, hour, day or week.

For Linux and macOS. Windows has no cron; use Task Scheduler there.

Cron runs commands on a schedule. Choose how often, enter the full path of your script, and copy the crontab line. Then add it with crontab -e.

Create your config file

Type your own values. The file below updates as you type, and nothing you type leaves your browser.

crontab -e
*/5 * * * *  /home/me/backup.sh >> /home/me/cron.log 2>&1

How this setup works

Diagram: crontab -e, then cron service, then Your script
crontab -e (you add a line) → cron service (checks every minute) → Your script (runs on time)

Step-by-step setup

  1. Make your script executable: chmod +x /home/me/backup.sh.
  2. Open the schedule: crontab -e.
  3. Paste the line above.
  4. Save and exit. Check with crontab -l.

What the important lines mean

Common errors and how to fix them

Job does not run
Use full paths. Cron has a small PATH, so python may not be found; write /usr/bin/python3.
Script works by hand, not in cron
Check the log file /home/me/cron.log and that the script is executable.

Frequently asked questions

How do I run a cron job every 5 minutes?
Use */5 * * * * followed by the command. Pick "Every 5 minutes" above to get the line.
Why is my cron job not running?
Most often the command needs a full path, the script is not executable, or it depends on environment variables cron does not have. Send the output to a log file and read it.
What do the five cron fields mean?
In order: minute, hour, day of the month, month, and day of the week. A star means every value.

Written for: cron on Ubuntu 24.04, macOS 14 · Updated 2026-10-02

Free tools that help

More server configs

See all 41 config generators