Xerobit

Cron Every 2 Hours: 0 */2 * * *

The cron expression for every 2 hours is 0 */2 * * *. It runs 12 times per day, and the table below explains every field.

  • Cron expression
    0 */2 * * *
  • Schedule
    every 2 hours
  • Runs per day
    12
  • Runs per 30 days
    360
  • systemd OnCalendar
    *-*-* 0/2:00:00
  • AWS EventBridge
    cron(0 0/2 * * ? *)

What 0 */2 * * * means

FieldValueMeaning
Minute0at minute 0
Hour*/2every 2th hour, starting at hour 0
Day of month*every day
Month*every month
Day of week*every day of the week

The five fields of a standard cron expression are, in order: minute, hour, day of month, month and day of week.

When every 2 hours runs

The first run times in a day are: 00:00, 02:00, 04:00, 06:00, 08:00, 10:00, 12:00, 14:00, 16:00, 18:00, 20:00, 22:00. Over time that is 12 per day, 84 per week, about 360 per 30 days and 4,380 per year.

Copy-ready syntax for every 2 hours

crontab

0 */2 * * * /path/to/script.sh >> /var/log/job.log 2>&1

GitHub Actions

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

GitHub Actions runs scheduled workflows in UTC and may start them a few minutes late when GitHub is busy.

Kubernetes CronJob

apiVersion: batch/v1
kind: CronJob
spec:
  schedule: "0 */2 * * *"
  concurrencyPolicy: Forbid

Setting concurrencyPolicy: Forbid stops a new run from starting while the previous one is still going.

systemd timer

[Timer]
OnCalendar=*-*-* 0/2:00:00
Persistent=true

AWS EventBridge

cron(0 0/2 * * ? *)

EventBridge cron has six fields and needs a ? in either the day-of-month or the day-of-week field. The simpler rate(2 hours) form works for fixed intervals.

When to use every 2 hours

Data warehouse extraction jobs often pull new records from transactional databases every two hours to feed reporting tools. Security scanners also use this cadence to perform lightweight vulnerability sweeps across internal network segments.

What can go wrong

Running heavy extraction queries every two hours can degrade database performance for user facing applications. If the query duration grows as data volume increases, it will eventually collide with the next scheduled run.

Cron uses the time zone of the machine or service running it, so check whether that is UTC or local time before you rely on the clock times above.

Other common schedules

FAQ

What is the cron expression for every 2 hours?

Use 0 */2 * * *. It is the standard five-field form accepted by Linux crontab, Kubernetes CronJobs and GitHub Actions.

How many times a day does 0 */2 * * * run?

12 times per day, or 360 over 30 days.

How do I test a cron expression?

Build it in the cron builder, which explains each field in plain English and lists the next run times.

More cron