Standard cron expressions
Five fields, as read by the cron daemon on Linux and defined by POSIX. The rule that catches people is how the two day fields combine.
At 04:30, on the 1st and the 15th of the month, or on Fridays.
Next 10 runs
Clock changes
In your config
In the other dialects
“Same schedule” means the same clock times. Schedulers still treat a clock change differently, as the table on the home page shows.
Keyboard: / edit the expression, 1 to 6 change dialect, t time zone, n next clock change, c copy the link, Esc leave a field.
Fields
| Field | Values | Special characters |
|---|---|---|
| Minute | 0–59 | * , - / |
| Hour | 0–23 | * , - / |
| Day of month | 1–31 | * , - / |
| Month | 1–12 or JAN–DEC | * , - / |
| Day of week | 0–7, where 0 and 7 are Sunday, or SUN–SAT | * , - / |
Special characters
*- Every value in the field.
,- A list:
1,15. -- An inclusive range:
9-17. A backwards range such as22-2is rejected. /- A step over a range or star:
*/15,0-23/2.20/15is not valid here; write20-59/15. @daily- Nicknames for common schedules:
@yearly,@annually,@monthly,@weekly,@daily,@hourlyand@reboot.
The two day fields
If day of month and day of week are both restricted, the job runs when either matches. 30 4 1,15 * 5 runs at 04:30 on the 1st, on the 15th and on every Friday. POSIX and the crontab man page both say so.
Time zones
The machine’s local zone, unless the crontab sets CRON_TZ, which cronie supports. It is not part of POSIX, so check your cron.
Clock changes
The man page says missing times never match and repeated times run twice, and that is what this page shows. The daemon can do better: cronie’s main loop catches up fixed-time jobs after a forward jump and does not repeat them after a backward one, although it warns that jobs using CRON_TZ can still be missed or run twice. Treat runs next to a clock change as implementation-specific.
Gotchas
- Vixie-derived cron decides a day field is unrestricted by its first character being
*. So0 0 */2 * 1needs both fields to match, which is the opposite of what the OR rule suggests. The Go library behind Kubernetes reads the same expression as OR. - POSIX itself has no steps or names.
*/5is a universal extension, not part of the standard. %in the command becomes a newline unless escaped. It lives in the command rather than the schedule, but it is whydate +%Fbreaks in a crontab.- cronie also has a random range,
~, picked when the crontab loads. No tool can predict those runs, and this one says so instead of guessing.
Examples to try
- 0 9 * * 1-5Weekdays at 09:00At 09:00, Monday through Friday
- */15 * * * *Every 15 minutesEvery 15 minutes
- 0 0 1 * *Midnight on the first of the monthAt 00:00, on the 1st of the month
- 30 4 1,15 * 5The man page’s example of the OR ruleAt 04:30, on the 1st and the 15th of the month, or on Fridays
- 0 0 1,15 * 1POSIX’s example: 1st, 15th and every MondayAt 00:00, on the 1st and the 15th of the month, or on Mondays
- 23 0-20/2 * * *Every other hour at minute 23At minute 23 from 00:23 through 00:23, from 02:23 through 02:23, from 04:23 through 04:23, from 06:23 through 06:23, from 08:23 through 08:23, from 10:23 through 10:23, from 12:23 through 12:23, from 14:23 through 14:23, from 16:23 through 16:23, from 18:23 through 18:23 and from 20:23 through 20:23