Cron expression explainer

What does that crontab line actually mean, and when will it next run? Type it, or start from a common schedule.

At 09:30, Monday to Friday.

30
minute
9
hour
*
day of month
*
month
1-5
day of week

A cron job that stops running says nothing. A heartbeat monitor notices the run that did not happen, and tells you.

Set up a heartbeat

The five fields

Minute (0-59), hour (0-23), day of the month (1-31), month (1-12 or jan-dec) and day of the week (0-7, where 0 and 7 are both Sunday, or sun-sat). A field can be * for every value, a list like 1,15, a range like 1-5, or a step like */10.

The rule that surprises people

When both the day of the month and the day of the week are set, cron runs on a day that matches either one, not both. 0 0 13 * 5 runs on every 13th and on every Friday, not only on Friday the 13th. The sentence above says so when it applies.

Shortcuts

@hourly, @daily, @weekly, @monthly and @yearly stand for the obvious schedules; @reboot runs once when the machine starts.