Skip to content
Webmaster Tools

Cron every 2 hours

The cron expression for every 2 hours is 0 */2 * * *, running at even hours on the hour. Odd-hour and working-hours variants, and the GitHub Actions and AWS forms.

Cron expression
0 */2 * * *
See the next run times

The expression

0 */2 * * *

Runs at minute 0 of every even hour: 00:00, 02:00, 04:00 … 22:00, every day. That's 12 times a day, and because 24 divides evenly by 2, the gap from 22:00 to the next 00:00 is also 2 hours.

Field Value Meaning
Minute 0 at minute 0
Hour */2 every 2nd hour, starting at 0
Day of month * every day
Month * every month
Day of week * every day of the week

The step counts from the start of the hour range (0), not from when you installed the job, and it starts over every day at midnight.

Variants

Schedule Expression
Every 2 hours on odd hours (01:00, 03:00…) 0 1-23/2 * * *
Every 2 hours at half past 30 */2 * * *
Every 2 hours from 8:00 to 18:00 0 8-18/2 * * *
Every 2 hours on weekdays 0 */2 * * 1-5
Every hour 0 * * * *
Every 3 hours 0 */3 * * *
Every 4 hours 0 */4 * * *

0 8-18/2 * * * runs at 8, 10, 12, 14, 16 and 18: a step on a range starts at the range's first value.

Where to write it

  • crontab (Linux, macOS): 0 */2 * * * /usr/local/bin/import.sh in crontab -e, in the server's time zone.
  • GitHub Actions: on: schedule: - cron: '0 */2 * * *'. UTC, so the even hours are even in UTC; with a UTC offset of an odd number of hours, they're odd hours locally. Pick a minute other than 0 to avoid the busiest slot.
  • Kubernetes CronJob: schedule: "0 */2 * * *", plus timeZone: "Europe/London" (or your zone) if the local hours matter.
  • AWS EventBridge: cron(0 0/2 * * ? *), six fields with ? for day of week. Or rate(2 hours), which counts from the rule's creation time rather than midnight.

Common mistakes

  • */2 * * * * is every 2 minutes. The step has to be in the hour field.
  • * */2 * * * runs every minute of every even hour: 60 runs from 00:00 to 00:59, then nothing until 02:00. The minute field needs a number.
  • Expecting "2 hours after the last run". Cron is clock-based; if the job takes 90 minutes, the next start is still at the next even hour, 30 minutes after it finishes.

Paste any expression into the Cron Expression Parser to see it in words and its next run times.