Xerobit

Cron Every 4 Hours: 0 */4 * * *

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

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

What 0 */4 * * * means

FieldValueMeaning
Minute0at minute 0
Hour*/4every 4th 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 4 hours runs

The first run times in a day are: 00:00, 04:00, 08:00, 12:00, 16:00, 20:00. Over time that is 6 per day, 42 per week, about 180 per 30 days and 2,190 per year.

Copy-ready syntax for every 4 hours

crontab

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

GitHub Actions

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

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 */4 * * *"
  concurrencyPolicy: Forbid

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

systemd timer

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

AWS EventBridge

cron(0 0/4 * * ? *)

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

When to use every 4 hours

Content delivery networks purge stale cache entries every four hours to balance freshness with origin server protection. Financial systems reconcile transaction batches at this interval to detect discrepancies before end of day processing.

What can go wrong

Load spikes occur predictably when cache purges force thousands of simultaneous requests back to the origin servers. Without proper throttling, the backend infrastructure can buckle under the sudden surge of uncached traffic.

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 4 hours?

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

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

6 times per day, or 180 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