Field-by-Field Breakdown of `0 0 * * 0`
| Position | Field Name | Allowed Values | Value in `0 0 * * 0` | Evaluation Meaning |
|---|---|---|---|---|
| 1 | Minute | 0 – 59 | 0 | 0 (At minute 0) |
| 2 | Hour | 0 – 23 | 0 | 0 (At midnight / 00:00) |
| 3 | Day of Month | 1 – 31 | * | * (Every day of the month) |
| 4 | Month | 1 – 12 | * | * (Every month) |
| 5 | Day of Week | 0 – 6 (Sun-Sat) | 0 | 0 (Sunday, also 7) |
Weekend Maintenance Window Scheduling
Sunday midnight represents the international industry standard for scheduled maintenance windows. Web traffic on consumer applications and business SaaS platforms is typically at its weekly nadir, making it the safest time to perform heavy database vacuuming and system updates.
In cron syntax, Sunday is unique because it can be represented as both `0` and `7`. Both `0 0 * * 0` and `0 0 * * 7` are valid in Vixie Cron, though `0` is standard POSIX.
The special string `@weekly` expands to `0 0 * * 0`. When executing large migrations or vacuum commands during this window, always notify operations teams in advance.
Common Production Scenarios for `0 0 * * 0`
PostgreSQL Database Full Vacuum & Reindex
Reclaims dead tuple storage space and rebuilds B-tree database indices to prevent query plan degradation.
/usr/bin/vacuumdb --all --analyze --fullLinux Server OS Security Package Updates
Applies non-breaking security updates and patches to Ubuntu/Debian packages during the weekly maintenance window.
/usr/bin/apt-get update && /usr/bin/apt-get upgrade -yCold Storage S3 Glacier Archive Sync
Archives immutable database backups older than 30 days to deep cold storage tiers for cost optimization.
/usr/local/bin/sync-glacier.shProduction Gotchas When Running `0 0 * * 0`
- Saturday vs Sunday Confusion: Remember that `0 0 * * 0` fires at midnight as Saturday transitions into Sunday, NOT Sunday night into Monday.
- Maintenance Overlap: If a full vacuum takes 4 hours, it may run into Sunday morning peak hours if scheduled too late.
- Sunday 0 vs 7: While almost all systems treat 7 as Sunday, stick with `0` for 100% POSIX portability.
Frequently Asked Questions About `0 0 * * 0`
Is Sunday represented by 0 or 7 in cron?
Both are accepted in modern Linux cron implementations. Day 0 and Day 7 both resolve to Sunday. However, `0` is the standard POSIX convention.
Is `@weekly` the same as `0 0 * * 0`?
Yes, the `@weekly` macro is an exact alias for `0 0 * * 0`.
How do I schedule a Sunday job for Sunday night (11:00 PM)?
Set minute to `0` and hour to `23`: `0 23 * * 0 /path/to/script.sh`.