Cron Expression Explainer
Read a cron schedule in plain English. Cron expressions are compact and easy to misread, and the cost of a misreading is a job running a thousand times more often than intended.
Field reference
| Position | Field | Range |
|---|---|---|
| 1 | Minute | 0-59 |
| 2 | Hour | 0-23 |
| 3 | Day of month | 1-31 |
| 4 | Month | 1-12 or JAN-DEC |
| 5 | Day of week | 0-6 or SUN-SAT (0 and 7 both mean Sunday) |
Special characters: * every value, , a list, - a range, "
/ a step. So */15 in the minute field means every fifteen minutes.
Common expressions
| Expression | Meaning |
|---|---|
* * * * * | Every minute |
*/5 * * * * | Every five minutes |
0 * * * * | Hourly, on the hour |
0 0 * * * | Daily at midnight |
0 9 * * 1-5 | 09:00 on weekdays |
0 0 1 * * | Midnight on the first of the month |
The day-of-month and day-of-week trap
When both the day-of-month and day-of-week fields are restricted, cron treats them as OR, not AND. 0 0 13 * 5 does not mean "Friday the 13th" — it fires on the 13th of every month and on every Friday. This surprises nearly everyone the first time, and it is why schedules occasionally run far more often than their author expected.