Cron every 4 hours: 0 */4 * * *
0 */4 * * * runs six times a day at midnight, 04:00, 08:00, midday, 16:00 and 20:00.
At a glance
- Expression
- 0 */4 * * *
- Fires
- 6 times a day, 42 times a week, 2,190 times in a non leap year.
- Restricted fields
- Minute pinned to 0, hour stepped by 4. Date fields open.
- Equivalent macro
- None.
- Hours matched
- 0, 4, 8, 12, 16, 20.
- Runs per shift
- Two runs in each eight hour shift, if the day is split at 00:00, 08:00 and 16:00.
In detail
Four divides 24 six times, so the runs are evenly spaced across the day with no remainder at midnight. The set includes both midnight and midday, which makes it easy to reason about in conversation: twice per eight hour shift, six times a day, four hours apart.
This is often the right frequency for a job whose cost is dominated by a full pass over data rather than by the number of changes. Six full passes a day gives a worst case staleness of four hours and a predictable daily cost, which is easier to capacity plan than an incremental job whose cost depends on how busy the day was.
The alignment with shift boundaries is genuinely useful in operations. A run at 00:00, 08:00 and 16:00 hands a fresh report to whoever is starting a shift, and the runs at 04:00, 12:00 and 20:00 sit in the middle of each one. If your shifts start at other hours, the start at step form moves the whole set: 0 2-23/4 gives 02:00, 06:00, 10:00, 14:00, 18:00 and 22:00.
Six runs a day is few enough that each one deserves an explicit success record. A log line per run is 2,190 lines a year, which is small enough to keep forever and dense enough that a missing entry is obvious when you scan for it.
Examples
0 */4 * * *0 2-23/4 * * *Fires at 02:00, 06:00, 10:00, 14:00, 18:00 and 22:00.
0 */4 * * 1-5 /opt/app/bin/refresh.sh >> /var/log/refresh.log 2>&130 runs a week.
Things that catch people out
- Six runs a day sounds forgiving, but a job that takes three hours leaves only one hour of slack. Track the runtime, not just the exit code.
- 0 */4 * * * pins the minute. Leaving the minute as an asterisk gives 360 runs a day, one per minute of each matched hour.
- On a daylight saving day in an observing zone, one of the six runs can be skipped or repeated depending on which hour moved. Run in UTC if the count must be exactly six.
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 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 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.
Cron every 8 hours: 0 */8 * * *
0 */8 * * * fires three times a day at 00:00, 08:00 and 16:00. Shift aligned, evenly spaced, and easy to move with a start at step form.
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 12 hours: 0 */12 * * *
0 */12 * * * fires twice a day, at 00:00 and 12:00. Identical to 0 0,12 * * *, and different from an arbitrary twice daily schedule.
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