Developer Toolbox

Cron: every 2 hours

The step goes in the hour field and the minute is fixed at 0, so the job runs twelve times a day, on the even hours.

Open in Cron Parser The expression is filled in: change it and watch the next runs.

Expression

0 */2 * * *
Meaning

At minute 0 past every 2nd hour: 00:00, 02:00 ... 22:00

Next 5 runs

Your time zone

The same schedule on other platforms

PlatformWritten asNote
Linux crontab0 */2 * * *Five fields, in the server's local time zone. A % in the command has to be escaped as \%.
GitHub Actions- cron: '0 */2 * * *'Five fields, in UTC unless a timezone (an IANA name such as Europe/Warsaw) is set next to cron. Default branch only. The shortest interval is 5 minutes; when GitHub is busy, runs start late and some are dropped.
Kubernetes CronJobschedule: "0 */2 * * *"Five fields, in the controller's time zone unless spec.timeZone is set (Kubernetes 1.27 and later). concurrencyPolicy decides what happens when runs overlap.
systemd timerOnCalendar=0/2:00Its own calendar syntax, in a .timer unit, local time. hourly, daily and monthly match cron, but weekly means Monday. Persistent=true catches up on runs missed while the machine was off.
AWS EventBridgecron(0 0/2 * * ? *)Prefer this to rate(2 hours), which counts from when the rule was created and lands at odd times.
Quartz / Spring0 0 0/2 * * ?Six fields, seconds first. Quartz needs ? in one of the day fields and counts Sunday as 1; Spring accepts ? and numbers days like cron.

Common mistakes

  • * */2 * * * runs every minute

    With the minute left as *, the job runs every minute of every even hour: 720 times a day instead of 12.

  • Odd hours

    Start the step at 1: 0 1-23/2 * * * runs at 01:00, 03:00 ... 23:00.

  • Clock changes break the spacing

    On the nights the clocks go forward or back, the real time between two runs around the change isn't two hours. Run the server in UTC if the spacing matters.