Field-by-Field Breakdown of `0 2 * * *`
| Position | Field Name | Allowed Values | Value in `0 2 * * *` | Evaluation Meaning |
|---|---|---|---|---|
| 1 | Minute | 0 – 59 | 0 | 0 (At minute 0) |
| 2 | Hour | 0 – 23 | 2 | 2 (At 2:00 AM / 02:00) |
| 3 | Day of Month | 1 – 31 | * | * (Every day of the month: 1-31) |
| 4 | Month | 1 – 12 | * | * (Every month: 1-12) |
| 5 | Day of Week | 0 – 6 (Sun-Sat) | * | * (Every day of the week: 0-6) |
The 2 AM Deep Maintenance Standard
2:00 AM (0 2 * * *) is globally recognized as the ideal time for heavy database vacuums, full disk integrity audits, and filesystem backups. For web services hosted in North America and Europe, user traffic reaches its lowest point between 2:00 AM and 4:00 AM local time.
Running heavy jobs at 2:00 AM ensures that any temporary latency spike or database table lock completes long before business users log in at 8:00 AM.
To avoid the DST missing hour bug where spring forward skips 2:00 AM entirely on local timezones, production servers should always operate in UTC.
Common Production Scenarios for `0 2 * * *`
Full Encrypted Database Dump to R2/S3
Dumps PostgreSQL or MariaDB clusters, encrypts with GPG keys, and streams to geo-redundant S3 cold storage.
pg_dumpall | gpg -e -r [email protected] | aws s3 cp - s3://backups/db-$(date +%F).sql.gpgOperating System Kernel & Security Updates
Runs unattended package upgrades on Ubuntu and Debian instances, patching CVE security flaws without user disruption.
/usr/bin/unattended-upgrade -dRedis Database RDB Snapshot Persistence
Executes BGSAVE on Redis in-memory databases to persist memory states to disk storage safely.
redis-cli bgsaveProduction Gotchas When Running `0 2 * * *`
- The DST Spring Forward Bug: If your server uses local US or European time, 2:00 AM is skipped during the spring DST shift! Run servers on UTC.
- Network Bandwidth Caps: Streaming 50GB database dumps at 2:00 AM can saturate server network interfaces. Throttle bandwidth with pv -L 10M.
- Lockfile Omission: If a 2 AM backup hangs, the next day's backup at 2 AM could corrupt the archive without flock protection.
Frequently Asked Questions About `0 2 * * *`
Why is 2 AM preferred for database backups?
2:00 AM is the global trough of web application traffic, minimizing the performance impact of database locks and disk I/O spikes.
How do I run a job at 2:30 AM?
Set minute to 30 and hour to 2: 30 2 * * * /path/to/script.sh.
How does DST affect 2 AM cron jobs?
On local-time servers, the spring forward clock jump skips 2:00 AM entirely, causing cron to skip the job. Always set server clocks to UTC (timedatectl set-timezone UTC).