Cron expression explainer
Paste the same expression into a free check.
Paste a cron expression. You get a sentence describing it, the next ten times it will fire in the time zone you choose, and a field-by-field breakdown. Warnings appear for expressions that probably don't do what you think.
The five fields
* * * * *
| | | | |
| | | | +-- day of week (0 to 6, Sunday = 0; 7 is also Sunday on many systems)
| | | +---- month (1 to 12, or JAN to DEC)
| | +------ day of month (1 to 31)
| +-------- hour (0 to 23)
+---------- minute (0 to 59)
Operators
| Symbol | Meaning | Example | Reads as |
|---|---|---|---|
* | every value | * * * * * | every minute |
, | list | 0 9,17 * * * | at 09:00 and 17:00 |
- | range | 0 9 * * 1-5 | at 09:00, Monday to Friday |
/ | step | */15 * * * * | every 15 minutes |
a-b/n | stepped range | 0 8-18/2 * * * | every 2 hours from 08:00 to 18:00 |
Examples worth bookmarking
| Expression | Plain English |
|---|---|
0 2 * * * | Every day at 02:00 |
30 3 * * 0 | Sundays at 03:30 |
0 */6 * * * | Every 6 hours, on the hour (00:00, 06:00, 12:00, 18:00) |
0 0 1 * * | Midnight on the 1st of each month |
15 14 1 1,4,7,10 * | 14:15 on the first day of each quarter |
*/5 9-17 * * 1-5 | Every 5 minutes during working hours on weekdays |
0 4 * * 6,0 | 04:00 on weekends |
Gotchas the explainer warns about
Day of month AND day of week
0 9 1 * 1 does not mean "the 1st, if it's a Monday". In standard cron, when both fields are restricted, the job runs when either matches: every Monday and also the 1st of the month. To run only on the first Monday, the usual trick is to check the date inside the script.
Steps don't wrap
*/7 in the minute field fires at 0, 7, 14, ... 56, then 0 again. That's a 4-minute gap at the top of the hour, not a steady 7.
Minute field set to *
* 2 * * * runs every minute from 02:00 to 02:59. Sixty runs. You almost certainly meant 0 2 * * *.
Time zones
Classic cron uses the server's local time. If the server is on UTC and you think in New York time, every schedule is off by four or five hours depending on the season. Some cron implementations support a CRON_TZ or TZ variable; many don't. Kubernetes CronJobs support a timeZone field in recent versions.
Daylight saving
In zones that observe DST, a job scheduled at 02:30 may run twice or not at all on the change-over nights, depending on the cron implementation. Schedule important jobs outside 01:00 to 03:00 local time, or run the server on UTC.
Non-standard syntax
Some systems add a seconds field (Quartz, Spring) or a year field. Some accept L, W and # for "last day", "weekday" and "nth weekday". Shortcuts like @daily and @reboot exist in many cron versions. The explainer accepts the common five-field format and the @ shortcuts, and warns if it sees six fields.
After you've got the schedule right
A correct expression only tells you when cron *should* start the job. It doesn't tell you the job ran, finished or worked. Ping Clock checks accept the same cron expression plus a time zone. Add one ping to the end of your job and you'll know within minutes when a scheduled run goes missing.
Questions
Which cron flavour does this follow?
Standard five-field Vixie cron, the one on most Linux servers, plus @ shortcuts.
Why are my "next run" times different from the server's?
Check the time zone. The explainer uses the one you pick; the server uses its own.