Cron every day except Sunday: 0 0 * * 1-6
Cron has no negation, so a day is excluded by listing the others. 0 0 * * 1-6 runs Monday through Saturday, six times a week.
At a glance
- Expression
- 0 0 * * 1-6
- Fires
- 6 times a week, about 313 times a year.
- Restricted fields
- Day of week restricted to 1-6. Minute and hour pinned, day of month and month open.
- Equivalent macro
- None.
- Days matched
- Monday (1) through Saturday (6). Sunday (0) is the only day left out.
- Excluding a middle day
- Needs a list, for example 0-3,5-6 to skip Thursday.
In detail
There is no exclusion operator anywhere in cron syntax. No exclamation mark, no minus prefix, nothing that means every value except this one. The only way to express an exclusion is to enumerate what remains, which is easy when the excluded day is at one end of the week and slightly tedious when it is in the middle.
Sunday is day 0, so leaving it out means starting the range at 1, and Saturday is the last day at 6, so the range ends there. 1-6 is the whole rest of the week in one token. If the day to exclude were Thursday instead, the field would be 0-3,5-6, a list of two ranges, which is still one field but is noticeably harder to read at a glance.
This shape usually appears where a downstream system has a weekly maintenance window. The job should not run during it, and the cheapest way to arrange that is to simply not schedule it. That is more reliable than a script that checks the day itself, because the schedule is visible in the crontab where someone reviewing the system will see it.
Do note that skipping a day is not the same as skipping the work. If the job processes a queue, Sunday's items are still there on Monday, and the Monday run has two days of backlog. Size the timeout and any batch limits for the biggest run rather than the typical one.
Examples
0 0 * * 1-60 0 * * MON-SAT0 0 * * 0-3,5-6Every day except Thursday. Two ranges joined by a comma.
Things that catch people out
- There is no not operator. Anything you have seen that looks like one belongs to a different scheduler dialect, not to cron.
- 1-6 leaves out Sunday, not Saturday. Off by one here is easy because the week starts at 0.
- The day after a skipped day carries the backlog. A job sized for one day of work can time out on the day that covers two.
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 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 at the weekend: 0 0 * * 0,6
0 0 * * 0,6 runs at midnight on Saturday and Sunday, twice a week. Why 6-7 works too, and why 6-0 is rejected as an invalid range.
The cron day of week field: 0 to 7 with Sunday at both ends
The day of week field runs 0 to 7 with Sunday as both 0 and 7, and accepts SUN through SAT. Restricting it changes how the day of month field behaves.
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 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.
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.
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