0 * * * * runs a job at minute 0 of every hour: 00:00, 01:00, 02:00 and on. The cron parser reads it as “At the start of every hour”, and the shortcut @hourly gives the same result.
Swapped fields: the classic mistake
People often write the right numbers in the wrong places. Compare:
| Expression | Meaning | Runs per day |
|---|---|---|
0 * * * * |
minute 0 of every hour | 24 |
* 0 * * * |
every minute of hour 0 | 60 (all between 00:00 and 00:59) |
0 0 * * * |
minute 0 of hour 0 | 1 |
Paste * 0 * * * into the parser and it says “Every minute, past hour 0” and lists 00:00, 00:01, 00:02, and so on. A job meant to run hourly instead hammers the system once a minute for an hour, then stays silent for 23 hours, which is easy to miss for a day. Always read the plain-language description back before you save a schedule.
Different minutes and hour patterns
30 * * * * # every hour at :30
15 */2 * * * # every second hour at :15 (00:15, 02:15, ...)
0 6,12,18 * * * # at 06:00, 12:00 and 18:00
0 8-18 * * 1-5 # on the hour from 08:00 to 18:00, Monday to Friday
The minute is what you want to fix first; the hour field then chooses which hours. A step such as */2 starts at hour 0 and restarts each day, so 0 */5 * * * yields 00, 05, 10, 15 and 20, and then 00 of the next day (a four-hour gap at the end).
Pick a less crowded minute
Minute 0 is the most crowded of all: backups, certificate renewals and thousands of scripts start at that instant. If your job calls a shared resource, start at a different minute (17 * * * *). It costs nothing and is kinder to everyone, including your own database.
Time zones and daylight saving
An hourly job in UTC never has a problem. In a local zone with daylight saving, a job fixed to one hour of the day can run twice or be skipped when the clock changes, and implementations differ in how they treat a job that runs every hour. Run servers in UTC and convert times in the application. The background is in cron and time zones.
Next steps
For a different rhythm, see every 15 minutes and every 6 hours; for a daily job, daily at midnight. The cron builder creates the expression from choices, and the parser checks it.
Frequently asked questions
What is the cron expression for every hour?
0 * * * *: minute 0 of every hour. The shortcut @hourly means the same on most systems. To run at half past the hour use 30 * * * *.
Why did my 'hourly' job run 60 times at midnight?
The star and the zero were in the wrong fields. * 0 * * * means 'every minute of hour 0', so it runs once a minute from 00:00 to 00:59. For once an hour the minute field is the zero: 0 * * * *.
Is @hourly the same as 0 * * * *?
Yes. The @ shortcuts are conveniences of Vixie-style cron: @hourly is 0 * * * *, @daily is 0 0 * * * and @monthly is 0 0 1 * *. They are not part of POSIX, so check your cron if you need to be portable.
How do I run every 2 hours?
0 */2 * * *, which runs at 00:00, 02:00, 04:00 and so on up to 22:00. For a different pattern list the hours: 0 6,12,18 * * *.
More in this reference
- Cron daily at midnight (0 0 * * *): @daily, time zones and a better hour
- Cron every 5 minutes (*/5 * * * *): syntax, the step operator and its limits
- Cron every 6 hours (0 */6 * * *): steps in the hour field
- Cron every 15 minutes (*/15 * * * *): quarter hours and staggered starts
- Cron every minute (* * * * *): how it works and the traps
- Cron every Monday at 9 AM (0 9 * * 1) and the day-of-month OR trap
- Cron on the first day of the month (0 0 1 * *): @monthly and its limits
- Cron on the last day of the month: why there is no L, and three working solutions
- Cron on weekdays at 9 AM (0 9 * * 1-5): Monday to Friday