Cron example
Cron Every Sunday at Midnight
The canonical weekly schedule, and what the weekly shorthand expands to on most systems: midnight at the start of Sunday, which is the midnight that ends Saturday. Fifty-two runs a year, always exactly seven days apart, with none of the month-length arithmetic that makes day-of-month schedules quietly unpredictable across February and the 31-day months.
By NaveenKumar T · Updated · 5-field crontab expression
What each field means
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | Minute 0 |
| Hour | 0 | Hour 0 |
| Day of month | * | Every day |
| Month | * | Every month |
| Day of week | 0 | Sunday |
Next 5 run times
Computing the next runs in your timezone…
Sunday is 0, and usually also 7
Cron's week is zero-indexed from Sunday, so 0 is Sunday and 6 is Saturday. Most implementations — Vixie cron, cronie, croner, Quartz-style parsers — additionally accept 7 as Sunday, which exists so that a range like 1-7 covers Monday through Sunday rather than failing. Both 0 0 * * 0 and 0 0 * * 7 therefore describe this schedule, and SUN works too.
Do not rely on 7 in a portable crontab: a few minimal implementations reject it, and readers coming from ISO 8601 will read 7 as Sunday but 0 as an error. Writing 0 is the safest single choice, and using SUN is the most legible.
Weekly by weekday versus weekly by date
A day-of-week schedule always lands on the same weekday, which is what you want for anything humans plan around. A day-of-month schedule such as 0 0 1,8,15,22 * * looks weekly but is not: it produces a gap of six to nine days at the end of every month, and the weekday wanders.
That difference matters for reporting. A weekly summary generated every Sunday covers exactly seven days every time, so week-over-week comparisons are honest. Any date-based approximation quietly makes some weeks longer than others, and the anomaly always shows up in the chart before anyone remembers why.
Placement and alternatives
Midnight Sunday is the quietest hour of the quietest day on most systems, which is why weekly backups, rotations and rebuilds gravitate here. Shift the hour if your Saturday evening traffic runs late — 0 3 * * 0 is a common compromise.
For work that must finish before Monday but needs more than a few hours, start earlier on Saturday. For a weekly job aimed at people rather than machines, move it into the working week with Monday at 8 AM.
Build a variant of this schedule with dropdowns and check the next ten runs before you install it.
Open the cron generatorRelated cron examples
Browse every schedule on the cron expression generator, read the cron expression syntax guide for the rules behind the five fields, or the developer tools guides for the longer explanations.