Cron Expression for Every Weekend
Use 0 0 * * 6,0 to run a cron job every weekend: it runs at 00:00 on Saturday and again at 00:00 on Sunday. That's twice per weekend — once at the start of each day.
At 12:00am on Sunday and Saturday.
0 0 * * 6,0Standard 5-field crontab syntax. Day of month and day of week are OR'd when both are set.
What it does
The day of week field lists two values, 6 (Saturday) and 0 (Sunday). A comma means “any of these”, so the midnight time matches on both days. 0 0 * * 0,6 means the same thing — the order of a list doesn't matter. What doesn't work is 6-0: a range has to run upwards, and Sunday is numbered 0, before Saturday.
Weekend runs are usually about using quiet time: full backups and integrity checks that would slow the database during the week, re-indexing search, vacuuming or rebuilding tables, running long test suites, or generating a weekly archive. Traffic is lower for most business sites, so heavy jobs disturb fewer people.
Twice a weekend isn't always what's wanted. If the job should run once, pick one day — 0 3 * * 6 runs at 03:00 every Saturday. And “Saturday midnight” is easy to misread: 0 0 * * 6 runs as Friday night turns into Saturday, not at the end of Saturday.
Check the server's timezone before relying on a weekend schedule. On a server running UTC, “Saturday” begins at 01:00 in Paris in winter and on Friday afternoon in California, so a job meant to wait until a region's working week is over may fire while people there are still at work.
How 0 0 * * 6,0 works, field by field
| FIELD | VALUE | MEANING |
|---|---|---|
| Minute | 0 | minute 0 |
| Hour | 0 | hour 0 (midnight) |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | 6,0 | Sunday and Saturday |
Put together, cron reads 0 0 * * 6,0 as: “At 12:00am on Sunday and Saturday.”
To see further ahead, paste the expression into the cron calculator, which lists the next ten run times and counts how many times the schedule runs in a year.
Frequently asked questions
Why is Sunday 0 in cron?
Cron numbers the days of the week from 0 (Sunday) to 6 (Saturday), following the C library's convention. Most implementations also accept 7 for Sunday, but 0 is the one every cron understands.
How do I run a cron job on Saturday and Sunday at 10am?
Set the time fields and list both days: 0 10 * * 6,0 runs at 10:00 on Saturday and at 10:00 on Sunday.
How do I run a job once per weekend rather than twice?
Choose a single day in the day of week field, such as 0 2 * * 0 for 02:00 every Sunday. A list like 6,0 always means one run on each listed day.