Cron Every Sunday
The 0 in the day-of-week field means Sunday (7 also means Sunday). With 0 0 in the minute and hour fields, the job runs at midnight every Sunday.
Cron Expression
0 0 * * 0Field Breakdown
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At minute 0 |
| Hour | 0 | At midnight (00:00) |
| Day of Month | * | Every day of the month |
| Month | * | Every month (1-12) |
| Day of Week | 0 | Sunday only (0 or 7) |
Variations
0 0 * * 0Every Sunday at midnight0 2 * * 0Every Sunday at 2 AM (low-traffic maintenance window)0 0 * * 7Every Sunday (7 is an alias for Sunday)Common Use Cases
- Weekly full backups during the quietest day
- Sunday-night database maintenance and reindexing
- Resetting weekly quotas before Monday
Tips & Best Practices
Both 0 and 7 represent Sunday in the day-of-week field.
Sunday is a popular choice for heavy maintenance because traffic is usually lowest.
Names also work in most cron implementations: 0 0 * * SUN.