Cron at the weekend: 0 0 * * 0,6
0 0 * * 0,6 runs at midnight on Saturday and Sunday, twice a week and about 104 times a year.
At a glance
- Expression
- 0 0 * * 0,6
- Fires
- 2 times a week, 104 or 105 times a year depending on how the year falls.
- Restricted fields
- Day of week restricted to two values. Minute and hour pinned, day of month and month open.
- Equivalent macro
- None.
- Days matched
- Sunday (0) and Saturday (6).
- Alternative forms
- 6,0 and 6-7 both match the same two days, because 7 folds to 0.
In detail
The weekend straddles the ends of the day of week field, because the field runs Sunday to Saturday and the weekend is the last day and the first. A comma list handles that in one token: 0,6 names both without needing a range. The parser sorts the values, so 6,0 is the same expression written in the order people say it out loud.
There is a second form that works because the field accepts 7 as an alias for Sunday. 6-7 is a valid range, counts up from Saturday to the alias, and folds 7 back to 0, giving the same two days. It reads more naturally as a weekend but it relies on a quirk, so the list is the safer thing to leave in a crontab.
What does not work is 6-0. A range must count upwards, and 6 to 0 is backwards, so it is rejected rather than wrapping around the end of the week. This is the same rule that stops an hour range spanning midnight, and it catches people the same way.
Weekend jobs are the natural home for anything expensive that would disrupt weekday traffic: a full reindex, a heavy report, a data integrity sweep. Two runs a week means the work has a long window, and it also means that when a weekend run fails, five days pass before the next attempt unless something alerts.
Examples
0 0 * * 0,60 0 * * SAT,SUNNames are case insensitive and match the same two days.
0 3 * * 6 /opt/app/bin/reindex.sh >> /var/log/reindex.log 2>&1One run a week, at 03:00 on Saturday.
Things that catch people out
- 6-0 is an invalid range, not a wrap around the weekend. Use the list 0,6 instead.
- 7 and 0 are the same day. Writing 0,6,7 is not three days, it is still Saturday and Sunday.
- A weekend job that fails on Saturday night has until the following Saturday before it runs again. Alert on failure rather than relying on the next run.
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.
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.
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 name aliases: JAN to DEC and SUN to SAT
The month and day of week fields accept three letter English names, case insensitively, in single values, ranges, lists and steps.
Cron every day except Sunday: 0 0 * * 1-6
Cron has no not operator, so excluding a day means listing the six you want. 0 0 * * 1-6 covers Monday through Saturday, six runs a week.
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.
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