ShareYourGroupShareYourGroupCron Helper

Cron expression for every 2 hours

Every 2 hours, on the hour, every day.

Five fields for Linux, GitHub Actions and Kubernetes (minute hour day month weekday). Six or seven for Quartz. Nothing you type leaves your device.

What it means and when to use it

Two-hour runs are a good fit for slow-changing data: refreshing a product feed, pulling a weather summary, checking certificates or syncing a spreadsheet. The star with /2 takes every second hour of the day starting from hour 0, so the runs land on the even hours. The cron manual gives the same example in its own words: */2 in the hours field is "every two hours".

Watch out for this

You may want the odd hours (01:00, 03:00 and so on) to avoid a busy even hour. Write 0 1-23/2 * * *, which starts the range at hour 1. Also notice the pattern breaks at midnight for intervals that do not divide 24: 0 */5 * * * runs at 0, 5, 10, 15 and 20 and then at 0 again, so the last gap of the day is only four hours.

What each field says

FieldWrittenMeans
Minute00
Hour*/20, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22 (12 values)
Day of month*every day of the month
Month*every month
Day of week*every day of the week

An example of the next runs

If it were Friday 13 November 2026 at 10:20 UTC, the next six runs would be these. Times are shown in UTC and in India time (UTC+5:30).

UTCIndia time
Fri 13 Nov, 12:00Fri 13 Nov, 17:30
Fri 13 Nov, 14:00Fri 13 Nov, 19:30
Fri 13 Nov, 16:00Fri 13 Nov, 21:30
Fri 13 Nov, 18:00Fri 13 Nov, 23:30
Fri 13 Nov, 20:00Sat 14 Nov, 01:30
Fri 13 Nov, 22:00Sat 14 Nov, 03:30

The same schedule in other places

Quartz

Quartz has a seconds field in front, uses ? in one day field, and counts Sunday as 1:

0 0 */2 * * ?

GitHub Actions

Scheduled workflows run in UTC unless you add a time zone. In the workflow file:

on:
  schedule:
    - cron: '0 */2 * * *'

Kubernetes CronJob

In a CronJob manifest the schedule goes in spec.schedule. Without spec.timeZone, it is read in the time zone of the cluster's controller:

spec:
  schedule: "0 */2 * * *"
  timeZone: "Etc/UTC"

A crontab line to copy

The command is made up. Replace it with your own and use full paths:

0 */2 * * * /home/me/bin/refresh-feed.sh >> /home/me/feed.log 2>&1

Questions

Why does the schedule use 0 in the minute field?

Without it, a star in the minute field would run the job every minute during each chosen hour. The 0 pins the run to the start of the hour.

This is an independent guide and tool. It is not connected with crontab.guru, Quartz, GitHub, Kubernetes, Spring or the Linux projects named here. Product names belong to their owners.