Cron every hour: 0 * * * *
0 * * * * runs once at the top of every hour, 24 times a day. It is exactly what the @hourly macro expands to.
At a glance
- Expression
- 0 * * * *
- Fires
- 24 times a day, 168 times a week, 8,760 times in a non leap year.
- Restricted fields
- Minute only, pinned to 0. Hour, day of month, month and day of week are open.
- Equivalent macro
- @hourly, which expands to exactly 0 * * * *.
- Minute matched
- 0. The job starts at hh:00:00 local time.
- Common mistake
- * */1 * * * looks hourly but fires every minute of every hour.
In detail
Pinning the minute to 0 and leaving the hour open is the canonical hourly schedule. The minute field has one matching value, the hour field has all 24, and the three date fields impose nothing, so the job runs at the top of every hour forever. @hourly is a shorthand for precisely this expression and the parser expands it to the same five fields.
The mistake worth naming is * */1 * * *. It reads as hourly to English speaking eyes, but the step of 1 in the hour field matches all 24 hours, exactly as an asterisk does, and the minute field is still open. The result is 1,440 runs a day rather than 24, discovered when the log grows sixty times faster than expected.
Minute 0 of every hour is the most contended minute on a typical machine. Log rotation, metric flushes, cache expiry and every other hourly job land there together. If the hourly job is heavy and the timing does not matter, moving it to any other minute is a one character change that often removes a visible spike.
On the day a zone leaves daylight saving time, the same wall clock hour happens twice, so an hourly schedule fires 25 times. On the day it enters, an hour disappears and it fires 23. Neither is an error, but a report that divides a daily total by 24 will be quietly wrong twice a year.
Examples
0 * * * *@hourly /opt/app/bin/rollup.sh >> /var/log/rollup.log 2>&1Identical schedule. The macro is accepted by the parser and by most cron daemons.
17 * * * * /opt/app/bin/rollup.shStill 24 runs a day, at seventeen minutes past each hour.
Things that catch people out
- * */1 * * * is not hourly. It is every minute, because the minute field is unrestricted.
- @hourly is understood by cron daemons but is not a value you can put in one field. It replaces the whole expression.
- An hourly job that processes the previous hour must derive that hour from the clock. If it uses now minus one hour and starts a few seconds late, it still lands in the right hour, but if it starts a few seconds early it does not.
Try it: Cron Expression Parser
Paste any five or six field expression to get a plain English description, a per field breakdown and the next run times in your local time.
Cron Expression Parser
LOCAL · Browser-OnlyParse cron expressions and see the next scheduled run times
Supports 5-field (minute hour day month weekday), 6-field (with seconds), named values (JAN, MON), and @macros (@daily, @hourly, ...)
Use the dropdowns below to build your cron expression visually, or type a custom value in each field.
Human-Readable Description
Every 5 minutes
Field Breakdown
| Field | Allowed | Value | Meaning |
|---|---|---|---|
| Minute | 0-59 | */5 | every 5 minute(s) |
| Hour | 0-23 | * | every hour |
| Day of Month | 1-31 | * | every day of month |
| Month | 1-12 | * | every month |
| Day of Week | 0-7 | * | every day of week |
Related cron expressions
All cron expressions →Cron every 2 hours: 0 */2 * * *
0 */2 * * * fires 12 times a day on even hours from 00:00 to 22:00. Use 0 1-23/2 * * * to run on odd hours instead, same twelve runs.
Cron every hour at 30 minutes past: 30 * * * *
30 * * * * runs 24 times a day at half past every hour. How to pick an offset minute deliberately and why the top of the hour is worth avoiding.
Cron every 30 minutes: */30 * * * *
*/30 * * * * fires 48 times a day at minutes 0 and 30. The half hour is the busiest slot on most servers, and 15,45 costs nothing to move to.
Cron macros: @daily, @weekly, @monthly and the rest
Seven macros expand to ordinary five field expressions, and @reboot has no scheduled time at all. Here is exactly what each one becomes.
Cron every 3 hours: 0 */3 * * *
0 */3 * * * fires eight times a day at 00:00, 03:00, 06:00 and on to 21:00. Three divides 24 exactly, so the midnight gap is the same as the rest.
Cron every 4 hours: 0 */4 * * *
0 */4 * * * fires six times a day at 00:00, 04:00, 08:00, 12:00, 16:00 and 20:00. Even spacing, and how to move the set off midnight.
Tools for this
- Cron Expression Parser Free online cron expression parser - parse cron expressions and see the next scheduled run times
- Crontab Generator Free online crontab generator - build cron expressions visually with an intuitive interface