Cron every Monday at 9 AM: 0 9 * * 1
0 9 * * 1 runs once a week, at 09:00 every Monday. A year contains 52 Mondays, or 53 when the calendar falls that way.
At a glance
- Expression
- 0 9 * * 1
- Fires
- Once a week, 52 or 53 times a year.
- Restricted fields
- Minute, hour and day of week all pinned. Day of month and month are open.
- Equivalent macro
- None. @weekly is fixed at Sunday midnight.
- Day number
- 1 is Monday. MON is accepted as an alias.
- Mondays in a year
- 52 in most years, 53 when 1 January or 2 January falls on a Monday in a leap year.
In detail
This is the canonical weekly report schedule: pin the minute, pin the hour, pin one day of week, and leave the date fields open so it happens every week rather than in a particular month. Day 1 is Monday because the field counts from Sunday as 0.
The count is not exactly 52. A common year is 52 weeks and one day, so one weekday occurs 53 times, and a leap year is 52 weeks and two days, so two weekdays do. Whether Monday is one of them depends on which day the year starts on. If a report is numbered by week, that is exactly where an off by one appears at the turn of the year.
Nine in the morning is matched against the daemon timezone, which on a default container image is UTC. For a report a human reads on a Monday morning that is worth checking rather than assuming, because being several hours out is obvious to the recipient and invisible in the crontab.
A weekly job has the longest recovery time of any common schedule. If Monday's run fails, the next scheduled attempt is seven days later, by which time the report is worthless. Retry inside the script, and alert on failure rather than on the absence of output, because nobody notices a missing weekly email until the second one is missing too.
Examples
0 9 * * 10 9 * * MON /opt/app/bin/weekly-report.sh >> /var/log/weekly.log 2>&10 9 * * 1,4Twice a week, with gaps of three and four days.
Things that catch people out
- Adding a day of month restriction turns the AND you expect into an OR. 0 9 1-7 * 1 fires on days 1 to 7 and on every Monday.
- A weekly failure costs a week. Do not rely on the next scheduled run as the retry.
- 0 9 * * 1 in a UTC daemon is 14:30 in India and 04:00 in New York. The expression does not say which nine in the morning you meant.
Try it: Cron Expression Parser
Paste any five or six field expression to get a plain English description, a per field breakdown and the next run times in your local time.
Cron Expression Parser
LOCAL · Browser-OnlyParse cron expressions and see the next scheduled run times
Supports 5-field (minute hour day month weekday), 6-field (with seconds), named values (JAN, MON), and @macros (@daily, @hourly, ...)
Use the dropdowns below to build your cron expression visually, or type a custom value in each field.
Human-Readable Description
Every 5 minutes
Field Breakdown
| Field | Allowed | Value | Meaning |
|---|---|---|---|
| Minute | 0-59 | */5 | every 5 minute(s) |
| Hour | 0-23 | * | every hour |
| Day of Month | 1-31 | * | every day of month |
| Month | 1-12 | * | every month |
| Day of Week | 0-7 | * | every day of week |
Related cron expressions
All cron expressions →Cron every Sunday at midnight: 0 0 * * 0 and @weekly
0 0 * * 0 runs at midnight every Sunday and is exactly what @weekly expands to. Sunday is both 0 and 7 in the day of week field.
Cron twice a week: 0 9 * * 1,4
0 9 * * 1,4 runs at 09:00 on Monday and Thursday, twice a week. Which two days you pick decides whether the gaps are three and four days.
Cron every Friday at 5 PM: 0 17 * * 5
0 17 * * 5 runs at 17:00 every Friday, once a week. Cron uses a 24 hour clock, so five in the afternoon is 17 and there is no PM suffix.
Cron day of month and day of week: the OR rule
When both date fields are restricted, cron fires if either matches, not both. This turns narrowing expressions into much wider ones without any error.
Cron on Monday, Wednesday and Friday: 0 0 * * 1,3,5
0 0 * * 1,3,5 runs on Monday, Wednesday and Friday, three times a week. A comma list is required because a step cannot skip weekend days.
Cron every 15 minutes on weekdays: */15 * * * 1-5
*/15 * * * 1-5 fires 96 times a weekday and 480 times a week. Combining a minute step with a weekday range, and how to add an hour window too.
Tools for this
- Cron Expression Parser Free online cron expression parser - parse cron expressions and see the next scheduled run times
- Crontab Generator Free online crontab generator - build cron expressions visually with an intuitive interface