Weekly schedules
Many implementations accept names too, such as 0 9 * * MON, but numbers work everywhere.
| Schedule | Expression |
|---|---|
| Every Sunday at 00:00 | 0 0 * * 0 |
| Every Monday at 09:00 | 0 9 * * 1 |
| Every Friday at 17:30 | 30 17 * * 5 |
| Saturday and Sunday at 10:00 | 0 10 * * 6,0 |
| Monday to Friday at 08:00 | 0 8 * * 1-5 |
| Monday, Wednesday and Friday at 07:00 | 0 7 * * 1,3,5 |
Day of month and day of week together mean OR
When both day fields are set, standard cron runs the job when either one matches, not both. 0 9 1-7 * 1 doesn't mean "the first Monday of the month": it runs on each of days 1 to 7 and on every Monday.
For the first Monday, schedule days 1 to 7 and check the weekday in the command (in crontab, % must be escaped as \%):
0 9 1-7 * * [ "$(date +\%u)" = 1 ] && /usr/local/bin/report.shEvery two weeks
Cron has no "every other week". Run weekly and skip odd weeks in the command, using the ISO week number:
0 9 * * 1 [ "$(expr $(date +\%V) \% 2)" -eq 0 ] && /usr/local/bin/sprint-report.shFrequently asked questions
Is Sunday 0 or 7 in cron?
Both, in most implementations: 0 and 7 both mean Sunday. 0 is the most portable choice.
Is @weekly the same as 0 0 * * 0?
Yes, in Vixie cron, cronie and Kubernetes it runs at midnight between Saturday and Sunday. GitHub Actions doesn't support @weekly, so write 0 0 * * 0 there.
Which time zone is Sunday in?
The scheduler's. On a UTC server, 0 0 * * 0 runs on Saturday evening in the Americas. Use the tool's Local time option to check.