Cron expression for every hour
0 * * * *The job runs at minute 0 of every hour, so at 00:00, 01:00, 02:00 and so on, twenty-four times a day. Many crons also accept @hourly as a shortcut.
Runs when: minute 0; every hour; every day of month; every month; any day of week.
Change it in the cron expression generatorHow the five fields read
| Field | Value | Reads as |
|---|---|---|
| Minute | 0 | at 0 |
| Hour | * | every value |
| Day of month | * | every value |
| Month | * | every value |
| Day of week | * | every value |
The next five runs
What people use it for
- Rolling up metrics into hourly buckets
- Syncing orders or inventory with another system
- Rotating small log files
The first field decides everything
A common mistake is writing * * * * * when the plan was hourly. The minute field must be a number: 0 * * * * runs once an hour, while * * * * * runs sixty times. A second trap is the time zone. In UTC the hour starts at :00, but it begins at :30 in India (UTC+5:30) and :45 in Nepal (UTC+5:45), so check what "on the hour" means for the people reading your logs.
Variations of every hour
| Expression | What it does |
|---|---|
17 * * * * | Every hour at 17 minutes past. |
0 9-17 * * 1-5 | Every hour from 09:00 to 17:00, Monday to Friday. |
30 */2 * * * | Every two hours, at :30 past: 00:30, 02:30, 04:30 and so on. |
The same schedule in four tools
Linux crontab
0 * * * * /path/to/commandAdd it with crontab -e. It runs in the machine's time zone.
Kubernetes CronJob
spec:
schedule: "0 * * * *"
timeZone: "Etc/UTC"
concurrencyPolicy: ForbidtimeZone is stable from Kubernetes 1.27. Without it, the controller's time zone applies. Forbid stops a new run starting while the last one is still going.
GitHub Actions
on:
schedule:
- cron: '0 * * * *'Schedules run in UTC from the default branch, and a run can start a few minutes late when GitHub is busy. Scheduled workflows in public repositories are disabled after 60 days without repository activity.
AWS EventBridge
cron(0 * * * ? *)EventBridge uses six fields, with a question mark in one of the two day fields, and rules run in UTC. Weekday numbers start at Sunday = 1, so names such as MON are safer than numbers.
Questions about every hour
- Is @hourly the same as 0 * * * *?
- In Vixie cron and the crons based on it, yes. Kubernetes CronJobs accept @hourly too. GitHub Actions and AWS EventBridge do not accept the @ shortcuts, so write the full expression there.
- How do I run hourly but skip the night?
- Limit the hour field: 0 7-22 * * * runs at the top of every hour from 07:00 to 22:00.
Nearby schedules
- Cron expression for every 30 minutes: Twice an hour.
- Cron expression for every 6 hours: Four runs a day instead of twenty-four.
- All schedules and the generator
Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.