Skip to content
Cron Cookbook

Run a job every 2 hours

The cron expression for every 2 hours is 0 */2 * * *. The */2 step in the hour field fires at 00:00, 02:00, 04:00 and every even hour through 22:00, 12 times a day. Keep the 0 in the minute field: * */2 * * * runs every minute during those hours.

crontab syntax · 5 fields
0*/2***

Next 5 runs

Vercel always runs schedules in UTC, and GitHub Actions does unless you set a time zone. Crontab and Kubernetes use the server's time zone.

Field by field

0Minute
At minute 0
*/2Hour
Every 2nd hour: 0, 2, 4 … 22
*Day of month
Every day of the month
*Month
Every month
*Day of week
Every day of the week

By platform

Most schedulers take the same five fields. The wrapper, time zone and limits differ.

crontab -e
# m h  dom mon dow   command
0 */2 * * * /usr/local/bin/sync.sh >> /var/log/sync.log 2>&1

Runs in the server's local time zone

Cron starts jobs with a minimal environment: use absolute paths, and send output to a log so failures don't disappear.

Other 2-hour schedules

The step counts from midnight, not from when the job was installed. Start the range at 1 for odd hours, or change the minute to move runs off the hour.

ExpressionRuns
0 0,2,4,6,8,10,12,14,16,18,20,22 * * *Same as 0 */2 * * *, with the hours listed
0 1-23/2 * * *Every 2 hours on the odd hours, 01:00 through 23:00
30 */2 * * *Every 2 hours at half past, 00:30 through 22:30
0 8-18/2 * * 1-5At 08:00, 10:00, 12:00, 14:00, 16:00 and 18:00, Monday through Friday