Cron expression for every 2 hours
Runs the job on every even hour, twelve times a day.
0 */2 * * *
On the hour, every 2 hours
Field by field
- Minute · 0–59
0only at minute 0 - Hour · 0–23
*/2every 2nd hour - Day of month · 1–31
*every day of the month - Month · 1–12 or JAN–DEC
*every month - Day of week · 0–7 or SUN–SAT
*every day of the week
Next runs in your local time
Where this cron expression shows up
- Pulling a report from a service that only updates every couple of hours
- Backups that are too heavy to run hourly
- Reconciliation jobs that can wait until the next even hour
Common variations
-
Every four hours
0 */4 * * * On the hour, every 4 hours
-
Every six hours
0 */6 * * * On the hour, every 6 hours
-
Every two hours during working hours only
0 8-18/2 * * * On the hour, every 2 hours, between 08:00 AM and 06:00 PM
The step lives in the hour field, so it fires on the even hours and starts again at midnight. 0 */2 * * * at 11:59 PM runs the next job at midnight, not two hours later.
Ranges, steps, and names are spelled out on the cheat sheet.