Cron twice a week: 0 9 * * 1,4
0 9 * * 1,4 runs twice a week, at 09:00 on Monday and Thursday. Those two days split the week as evenly as seven days allow.
At a glance
- Expression
- 0 9 * * 1,4
- Fires
- 2 times a week, about 104 times a year.
- Restricted fields
- Day of week restricted to two values, minute and hour pinned. Day of month and month open.
- Equivalent macro
- None.
- Days matched
- Monday (1) and Thursday (4).
- Gap pattern
- Three days from Monday to Thursday, four days from Thursday to Monday.
In detail
Seven is odd, so no pair of days splits the week evenly. Monday and Thursday come closest, with gaps of three days and four days, and that asymmetry is the only real decision in this expression. Tuesday and Friday give the same split shifted by a day; Monday and Friday give four and three in the other order, with both runs inside the working week.
Choosing the pair is usually about what the job is for. A job feeding a human process wants both runs on working days, so Monday and Thursday or Tuesday and Friday. A job doing heavy background work wants the runs where traffic is low, which often means one weekday and one weekend day, such as 0 3 * * 3,6.
The four day gap is the one that determines capacity. If the job processes everything accumulated since the last run, the Monday run after the weekend handles four days of input while the Thursday run handles three. Batch limits and timeouts have to be sized for the larger of the two, or the schedule quietly fails one run in two.
As with every day of week schedule, leaving the day of month field open is what keeps the logic simple. Adding a day of month restriction alongside the weekday list switches the parser to the OR rule and the job starts running on days you did not ask for.
Examples
0 9 * * 1,40 9 * * MON,THU /opt/app/bin/sync.sh >> /var/log/sync.log 2>&10 3 * * 3,603:00 on Wednesday and Saturday.
Things that catch people out
- The two gaps are never equal. Any calculation that divides a weekly total by two will be wrong for both runs.
- 0 9 * * 1,4 and 0 9 * * 1-4 differ by one character. The second runs four days a week, not two.
- Day numbers count from Sunday as 0, so 4 is Thursday, not Wednesday.
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 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 Monday at 9 AM: 0 9 * * 1
0 9 * * 1 runs at 09:00 every Monday, 52 or 53 times a year. Day 1 is Monday, and the fifth field is the only one that needs to change.
The cron comma: listing several values in one field
A comma joins several values into one field, and each element can itself be a value, a range or a step. Spaces inside a list break the expression.
Cron every weekday: 0 0 * * 1-5
0 0 * * 1-5 runs at midnight Monday through Friday, five times a week. Day numbers, the MON-FRI alias, and why holidays still get a run.
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.
Cron every 2 weeks: what cron cannot do and what to write
Cron has no fortnight. The two honest options are a semi monthly 1,15 schedule or a weekly job with a week parity test in the script.
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