Developer guide

Cron Every Hour & Every 30 Minutes: Syntax, Examples & Gotchas

“Every hour” is 0 * * * * — but* * * * * runs 1,440 times a day, not 24. This guide has the exact expressions for hourly, 30-minute, 2-hourly and 15-minute schedules, the run-count math behind each one, and the */ gotchas that quietly shift jobs to the wrong minute.

Benjamin Rotshtein

Written by Benjamin Rotshtein

Updated

How do I run a cron job every hour?

Use 0 * * * * to fire at the top of every hour, */30 * * * * for every 30 minutes, and 0 */2 * * * for every 2 hours. The first field is the minute, so a leading 0 in that position means "at minute zero". The step gotchas below show why expressions like * */2 * * * are not what you want.

Every hour?
0 * * * * — 24 runs per day, on the hour.
Every 30 minutes?
*/30 * * * * — 48 runs per day at :00 and :30.
Every 2 hours?
0 */2 * * * — 12 runs per day at even hours.

The quick reference table

ExpressionMeaning
* * * * *Every minute — 1440 runs/day
*/15 * * * *Every 15 minutes — 96 runs/day
*/30 * * * *Every 30 minutes — 48 runs/day
0 * * * *Every hour on the hour — 24 runs/day
0 */2 * * *Every 2 hours — 12 runs/day
0 0,12 * * *Twice a day at midnight and noon — 2 runs/day

Every hour: 0 * * * *

0 * * * * means “minute 0 of every hour” — the job fires at 00:00, 01:00, 02:00 ... 23:00, 24 times a day. The single most common mistake here is writing:

# WRONG — runs EVERY MINUTE, 1440 times a day
* * * * * /opt/scripts/check.sh

# RIGHT — runs every hour on the hour, 24 times a day
0 * * * * /opt/scripts/check.sh

The first field is minutes, not hours. Leaving it as * tells cron to fire at every minute, and your “hourly” job becomes a 1,440-run-per-day mistake.

Every 30 minutes: */30 * * * *

*/30 * * * * steps through the minute field from 0 in increments of 30, so the job fires at minute 0 and minute 30 of every hour — 48 runs per day. Equivalent spelling: 0,30 * * * *.

The gotcha: step values always anchor to the lower bound of the field. You cannot write “every 30 minutes starting at :15” with a step — use 15,45 * * * * for that instead.

Every 2 hours: 0 */2 * * *

Here the step moves to the hour field: 0 */2 * * * runs at even hours — 00:00, 02:00, 04:00 ... 22:00 — 12 times a day. Confusion alert: */2 * * * * is every 2 minutes (720 runs/day), not every 2 hours. The step applies to whichever field it sits in, so read the position before you paste it.

Twice a day: 0 0,12 * * *

A comma list gives you explicit wall-clock times instead of steps. 0 0,12 * * * runs at midnight and noon;0 9,17 * * * runs at 9 AM and 5 PM. This is the right tool whenever you want specific hours rather than an arithmetic interval — and it is immune to the “anchored to zero” surprise of steps.

Every 15 minutes and other steps

The same pattern scales: */15 * * * * fires 96 times a day (every 15 minutes), */10 * * * * fires 144 times, and */5 * * * * fires 288 times. At the extreme end of high-frequency scheduling the minute field bottoms out — the 6-field seconds format exists for intervals under a minute.

Calculating runs per day exactly

For any step value the run count is: the number of matching values in the minute field, times the matching hours.0 */2 * * * → 1 minute × 12 hours = 12 runs/day. */30 * * * * → 2 minutes × 24 hours = 48 runs/day. If your expected load is off by an order of magnitude, you almost certainly wrote the step in the wrong field. For verification, the cron-not-running guide shows how to confirm a job actually fires.

Generate a valid expression

Build the schedule in plain English — the Cron Generator produces the correct 5-field string and previews the next 5 runs, so “every 2 hours” is never mistaken for “every 2 minutes” again.

Frequently asked questions

How do I run a cron job every hour?

Use 0 * * * * — minute 0 of every hour, which runs 24 times per day. Do not use * * * * * for 'every hour'; that is every minute (1440 runs per day).

How do I run a cron job every 30 minutes?

Use */30 * * * * (or 0,30 * * * *). It fires at minute 0 and minute 30 of every hour — 48 runs per day. Be aware that */30 always aligns to the hour boundary and never gives a 30-minute offset like 09:15, 09:45.

What does */2 * * * * mean?

Every 2 minutes. A common confusion: 0 */2 * * * is every 2 hours (12 runs per day), while */2 * * * * is every 2 minutes (720 runs per day). The step applies to the field you attach it to.

How many times does 0 */2 * * * run per day?

Twelve. The hour field takes values 0, 2, 4, ... 22, and the minute is fixed at 0, so the job fires at 00:00, 02:00, 04:00 and so on — 12 executions a day.

What is the difference between * * * * * and 0 * * * *?

* * * * * fires every minute (1440 runs/day). 0 * * * * fires once per hour at minute 0 (24 runs/day). If you only want hourly, the 0 in the minute field is required — * in that position means every minute.

Why does my every-30-minutes job not run when I expect?

Step values in cron always anchor to the field's lower bound. */30 starts at minute 0 and steps by 30, so you get :00 and :30 of each hour. To offset (e.g. :15 and :45), write 15,45 * * * * instead of */30.

Related guides