Cheat Sheets · Cron Cheat Sheet · Cron Every 2 Hours — Crontab Example
Cron Every 2 Hours — Crontab Example
0 */2 * * *
Runs at minute 0 of every 2nd hour (00:00, 02:00, 04:00, …).
Field by field
| Field | Value | Meaning |
|---|---|---|
Minute | 0 | At minute 0 |
Hour | */2 | Every 2nd hour (0, 2, 4, … 22) |
Day of month | * | Every day |
Month | * | Every month |
Day of week | * | Every day of the week |
Every 2 hours is ideal for periodic cache refreshing, warmups, and intermediate database rollups. The step */2 in the hour field starts at 0, firing at 00:00, 02:00, 04:00, and so on.
To fire on odd hours instead (01:00, 03:00, 05:00…), set a range before the step: 0 1-23/2 * * *.
0 */2 * * * /usr/local/bin/sync-cache.sh
Related schedules
FAQ
How do I run on odd hours instead of even hours?
Use a range: 0 1-23/2 * * * starts counting from 1 instead of 0.
Does it run at midnight?
Yes, hour 0 is midnight. If you want to skip midnight, use an explicit list like 0 2,4,6,8,10,12,14,16,18,20,22 * * *.
Why minute 0 instead of *?
Writing * */2 * * * means every minute during those hours (60 runs per active hour). Always fix the minute field for hourly cadences.
Stop memorizing — build it interactively
Try this schedule in the Cron EditorFull reference: Cron Cheat Sheet