Field-by-Field Breakdown of `0 0 * * *`
| Position | Field Name | Allowed Values | Value in `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) | * | * (Every day of the week) |
Midnight Job Scheduling & Midnight Contention
The expression `0 0 * * *` is the universal standard for once-daily background jobs. Operating systems and hosting providers frequently see enormous CPU and disk I/O spikes at 00:00:00 because thousands of automated maintenance tasks, log rotators, and backups fire simultaneously.
Linux distributions support the `@daily` or `@midnight` macro, which is an exact synonym for `0 0 * * *`. While human-readable, explicit five-field notation is preferred in containerized and cross-platform infrastructure.
In production, consider offsetting daily tasks to off-peak minutes, such as `17 2 * * *` (02:17 AM). Offsetting avoids database connection saturation and reduces contention with systemd timers.
Common Production Scenarios for `0 0 * * *`
Full Database Backup to S3 Cold Storage
Dumps PostgreSQL or MySQL databases, compresses the archive, and streams the snapshot to AWS S3 or Cloudflare R2.
pg_dumpall | gzip | aws s3 cp - s3://my-backups/$(date +%F).sql.gzDaily Analytics & Aggregation Ledger
Calculates total daily gross volume, net merchant payouts, and active user counts, writing summary rows to data warehouse tables.
/usr/bin/python3 /opt/analytics/rollup_daily_stats.pySSL Certificate Expiry Audit
Checks Let's Encrypt TLS certificates and triggers Certbot automated renewal if certificates are within 30 days of expiry.
/usr/bin/certbot renew --quietProduction Gotchas When Running `0 0 * * *`
- Timezone Mismatches: If the server is set to UTC, `0 0 * * *` fires at 00:00 UTC (which is 8:00 PM EST or 5:00 PM PST the prior evening).
- Daylight Saving Time (DST): During clock changeovers, jobs scheduled between 1:00 AM and 3:00 AM can run twice or be skipped depending on the Linux distribution's cron implementation.
- Missed Jobs on Shutdown: If a physical server or laptop is powered off at midnight, cron will not catch up when booted unless using `anacron`.
Frequently Asked Questions About `0 0 * * *`
Can I use `@daily` instead of `0 0 * * *`?
Yes, `@daily` and `@midnight` are standard cron aliases that expand to `0 0 * * *`, executing at 00:00:00 every day.
How do I run a daily cron job at 3:30 AM instead of midnight?
Set minute to `30` and hour to `3`: `30 3 * * * /path/to/script.sh`. Running in the early morning minimizes user impact on production web traffic.
What happens if my server is turned off at midnight?
Standard cron misses the scheduled execution and does not run it upon reboot. To catch up missed daily jobs, configure `anacron` or a systemd persistent timer.