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 (Every 2nd hour: 0, 2, 4... 22) |
| 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) |
Bi-Hourly Scheduling & Even-Hour Distribution
A bi-hourly schedule (every 2 hours) is ideal for maintenance tasks that require significant compute or database I/O, such as updating sitemaps, vacuuming temporary tables, and syncing remote CRM data.
The expression 0 */2 * * * evaluates only even hours (00:00, 02:00, 04:00, etc.). If you want odd hours (01:00, 03:00, 05:00, etc.), use the range step notation 0 1-23/2 * * *.
Always ensure the minute field is fixed (e.g. 0 or 15). Omitting the minute field and writing * */2 * * * is a disastrous bug that executes the job every minute for an entire hour.
Common Production Scenarios for `0 */2 * * *`
Dynamic XML Sitemap Re-generation
Regenerates search engine sitemaps and dispatches update pings to Google Search Console for newly published content.
/usr/bin/node /var/www/site/scripts/build_sitemaps.jsCRM Contact & Lead Status Synchronization
Pushes converted leads and marketing qualification flags to Salesforce or HubSpot API endpoints.
/usr/bin/python3 /opt/crm/sync_lead_statuses.pyDatabase Read-Replica Consistency Check
Computes checksums on critical transaction rows between master and read-replicas to catch replication drift.
/usr/local/bin/verify_replica_checksums.shProduction Gotchas When Running `0 */2 * * *`
- The Asterisk Minute Bug: Writing * */2 * * * will run your task 60 times during every even hour! Always lock the minute field (e.g. 0 */2 * * *).
- Server Reboots: If the server restarts during an execution hour, cron does not backtrack missed runs.
- Peak Hour Load: Even hours like 12:00 PM and 02:00 PM overlap with daytime traffic. Schedule heavy scripts for odd off-peak hours if possible.
Frequently Asked Questions About `0 */2 * * *`
Why did my * */2 * * * job run 60 times in an hour?
Because you placed an asterisk in the minute field. An asterisk matches all 60 minutes. To run once every 2 hours, lock minute to zero: 0 */2 * * *.
How do I run every 2 hours on odd hours?
Use range step syntax in the hour field: 0 1-23/2 * * * /path/to/script.sh. It will execute at 01:00, 03:00, 05:00... 23:00.
How many times does 0 */2 * * * execute per day?
Exactly 12 times per day (24 hours divided by 2).