Cron every 2 hours: 0 */2 * * *
0 */2 * * * runs 12 times a day at the top of every even hour, from midnight through to 22:00. Odd hours need 0 1-23/2 * * * instead.
At a glance
- Expression
- 0 */2 * * *
- Fires
- 12 times a day, 84 times a week.
- Restricted fields
- Minute pinned to 0 and hour stepped by 2. Date fields are open.
- Equivalent macro
- None.
- Hours matched
- 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22.
- Odd hour equivalent
- 0 1-23/2 * * * matches 1, 3, 5 ... 23.
In detail
Two divides 24 exactly, so the twelve runs are evenly spaced and the midnight boundary needs no special thought: 22:00, then 00:00 two hours later. The step starts from the bottom of the hour field, which is 0, so the matched hours are the even ones. There is nothing you can add to */2 to shift that; an explicit range starting at 1 is the only way to get the odd half.
Odd hours are worth considering precisely because even hours are crowded. Midnight, 02:00, 04:00 and 06:00 are where backups, log rotation and nightly maintenance already live, so a two hourly job on even hours competes with all of them for four of its twelve runs. On odd hours it competes with almost nothing.
Two hours is a comfortable window for work that touches an external system with a daily quota. Twelve runs means each run can consume a twelfth of the budget, and if one run fails the next attempt is close enough that the backlog does not become a separate problem. It also means a failure is unlikely to be noticed for two hours unless the job reports it.
Because the expression pins a wall clock hour, the count moves on daylight saving days in zones that observe it. Losing an hour drops one of the twelve runs if the missing hour happened to be even, and gaining one adds a run for the same reason. Scheduling in UTC removes the question entirely for jobs where the exact local hour does not matter.
Examples
0 */2 * * *0 1-23/2 * * *Fires at 01:00, 03:00, 05:00 and so on to 23:00. Still twelve runs a day.
20 */2 * * * /opt/app/bin/digest.sh >> /var/log/digest.log 2>&1Things that catch people out
- 0 */2 * * * has a leading zero for a reason. Writing */2 * * * * moves the step into the minute field and gives 720 runs a day.
- The gap from 22:00 to 00:00 is two hours like every other gap, but the run at midnight belongs to the next calendar day, which matters if the job partitions output by date.
- */2 in the hour field cannot be offset by adding a number. 0 2/2 * * * means start at hour 2 and step by 2, which happens to give the same even hours minus midnight.
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 hour: 0 * * * *
0 * * * * fires 24 times a day at the top of every hour and is what @hourly expands to. Why * */1 * * * is the mistake people make instead.
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.
Cron n/step: starting a step from a value you choose
The form 5/15 means start at 5 and step by 15, giving 5, 20, 35 and 50. It is how you move a repeating job off the crowded top of the hour.
Cron every 5 hours: 0 */5 * * * and the four hour gap
0 */5 * * * fires five times a day at 00:00, 05:00, 10:00, 15:00 and 20:00, then waits four hours instead of five. Here is why and what to do.
Cron every 6 hours: 0 */6 * * *
0 */6 * * * fires four times a day at 00:00, 06:00, 12:00 and 18:00. Even spacing, quarter day alignment, and how to shift the whole set.
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