The five fields
| Field | Allowed values |
|---|---|
| Minute | 0 to 59 |
| Hour | 0 to 23 |
| Day of month | 1 to 31 |
| Month | 1 to 12, or jan to dec |
| Day of week | 0 to 7, or sun to sat. Both 0 and 7 mean Sunday. |
*means every value.1,15is a list, and9-17is a range that includes both ends.*/15is a step: every 15th value, so minutes 0, 15, 30 and 45. Steps work on ranges too:0-30/10is 0, 10, 20 and 30.- Shortcuts:
@hourly,@daily(or@midnight),@weekly,@monthlyand@yearly.
The day-of-month and day-of-week trap
If you restrict both day fields, cron runs when either matches, not both. 0 0 13 * 5 runs at midnight on every 13th and every Friday, not only on Friday the 13th. If one of them starts with *, the usual "both must match" rule applies. This explainer follows cronie and Vixie cron, the cron found on most Linux systems.
Other gotchas
- Time zone. Cron uses the server's time zone, which is often UTC on cloud machines. GitHub Actions schedules always run in UTC. The next runs above are shown in your browser's time zone.
- Clock changes. In cronie, a time that's skipped when the clocks go forward never runs, and a time that's repeated when they go back runs twice. The list above leaves out times that don't exist. To be safe, avoid scheduling important jobs between 01:00 and 03:00 local time, or run the server on UTC.
- Steps don't carry over. A step only counts within its own field, so
*/23in the hour field means 00:00 and 23:00 each day, not every 23 hours. - Percent signs. In a crontab line,
%means a new line. Write\%in commands such asdate +\%F. - A bare environment. Cron jobs run with a minimal PATH and no login shell, so use full paths to programs and files. Our Linux command line guide covers paths.
- Some systems add a sixth field for seconds or years, such as Quartz and AWS EventBridge. This tool covers the standard five.