Cron expression for every hour

Free

0 * * * * - Every hour, on the hour.

Field by field

0 * * * * reads: Every hour, on the hour. That is 24 runs a day.

What each field of 0 * * * * selects
FieldValueSelects
Minute00
Hour*every hour
Day of month*any day of the month
Month*every month
Day of week*any day of the week

Worth knowing

  • The 0 is the minute. * * * * * with a star there runs every minute, which is the most common way this schedule goes wrong.
  • Every hourly job on a machine starting at :00 is how a server spikes on the hour. Pick an odd minute - 17 * * * * - when the exact minute does not matter.
  • @hourly is the same schedule in most cron implementations.

Variations

  • 17 * * * *Every hour at 17 minutes pastExplain it
  • 0 9-17 * * 1-5Every hour on the hour during office hours on weekdaysExplain it

The same schedule elsewhere

crontab

0 * * * * /path/to/job.sh

Runs in the machine's local timezone. crontab -e to edit.

GitHub Actions

on:
  schedule:
    - cron: "0 * * * *"

Always UTC. Nothing more often than every 5 minutes, and runs can start late when GitHub is busy.

Kubernetes CronJob

spec:
  schedule: "0 * * * *"
  timeZone: "Asia/Kolkata"

timeZone needs Kubernetes 1.27 or later; without it the controller's zone applies, usually UTC.

Spring @Scheduled

@Scheduled(cron = "0 0 * * * *")

Six fields: seconds come first. Days are written as names, which Spring and cron read alike.

Quartz

0 0 * * * ?

One of day-of-month and day-of-week must be ?. Quartz counts days 1-7 from Sunday, so names are safer than numbers.

AWS EventBridge

cron(0 * * * ? *)

Six fields, the last one the year. UTC unless the schedule sets a timezone. Days count from Sunday, as in Quartz.

systemd timer

[Timer]
OnCalendar=hourly
Persistent=true

Persistent=true runs a job that was missed while the machine was off, once it is back.