Cron every 30 minutes: */30 * * * *
*/30 * * * * runs twice an hour, 48 times a day, at minute 0 and minute 30. It is identical to writing 0,30 * * * *.
At a glance
- Expression
- */30 * * * *
- Fires
- 48 times a day, 2 times an hour, 336 times a week.
- Restricted fields
- Minute only. Hour, day of month, month and day of week are open.
- Equivalent macro
- None.
- Minutes matched
- 0 and 30.
- Identical forms
- */30, 0,30 and 0-30/30 all produce the same two values.
In detail
Half hourly is the schedule people reach for when hourly is not often enough and quarter hourly feels excessive. It fires on minute 0 and minute 30, the two busiest minutes on almost any machine, because they are also where hourly jobs, quarter hourly jobs and most human scheduled work land.
Since only two minutes are involved, the offset fix is unusually cheap: 15,45 * * * * gives the same two runs an hour on minutes that nothing else contends for. There is no step form that produces 15 and 45 from a bare asterisk, so the list is the natural way to write it, and 15-59/30 is a less readable way of saying the same thing.
A half hourly job has thirty minutes of headroom, which tempts people into doing real work in it: a full table scan, a report render, an export to object storage. That is fine until the work grows past the interval, and unlike a one minute job the failure is slow to appear. Log the duration of every run and alert when it passes half the interval, not when it passes the whole one.
The schedule takes no notice of the date, so it also fires forty eight times on the day of a planned maintenance window and forty eight times on Christmas Day. If the downstream system has a quiet period, adding an hour or day of week restriction to the same expression is a one field change and cuts a lot of pointless error mail.
Examples
*/30 * * * *15,45 * * * *Still twice an hour, but at quarter past and quarter to.
0,30 8-18 * * 1-5 /opt/app/bin/export.sh >> /var/log/export.log 2>&122 runs a weekday, 110 a week.
Things that catch people out
- */30 does not mean thirty minutes after the last run. If the daemon restarts at 10:29 the next run is still 10:30, one minute later.
- A job with a thirty minute schedule and a thirty minute lock timeout will occasionally have the lock released a fraction before the next run starts, which produces overlap exactly when the system is already slow.
- The hour field only reaches 23, so */30 there gives hour 0 alone. Half hourly always belongs in the minute field.
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 15 minutes: */15 * * * *
*/15 * * * * fires 96 times a day on the quarter hours. What happens to the count on the two daylight saving days, and how 7-59/15 spreads the load.
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.
The cron comma: listing several values in one field
A comma joins several values into one field, and each element can itself be a value, a range or a step. Spaces inside a list break the expression.
Cron every 45 minutes: why */45 * * * * does not do it
*/45 * * * * fires at minute 0 and minute 45 only, so the gaps alternate 45 and 15 minutes. Here is the four line crontab that really runs every 45 minutes.
Cron every 90 minutes: the two line crontab that works
Ninety minutes crosses the hour boundary, so no single cron expression covers it. Two lines stepping the hour field by 3 give an exact 16 run day.
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