Skip to the tool
DevToolBench

Cron Every 30 Minutes

Half-hourly schedules, and the trap next door.

minute hour day-of-month month day-of-week

At every 30th minute past every hour.

Fields

minute
*/30
hour
*
day of month
*
month
*
day of week
*

Next 5 runs

Times shown in your own timezone.

Common schedules

Half-hourly schedules

ExpressionWhat it doesCopy
*/30 * * * *On the hour and on the half hourAt every 30th minute past every hour.
0,30 * * * *The identical schedule, spelled outAt minute 0 and 30 past every hour.
15,45 * * * *Half-hourly, shifted to the quartersAt minute 15 and 45 past every hour.
*/30 9-17 * * 1-5Half-hourly, office hours onlyAt every 30th minute past every hour from 9 through 17 on every day-of-week from Monday through Friday.

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Two spellings, one schedule

A cron every 30 minutes schedule runs 48 times a day, on the hour and on the half hour. There are two ways to write it, and they are exactly equivalent: a step of thirty over the whole minute field, or a list naming minute 0 and minute 30. Both expand to the same two values, both produce the same next runs, and neither is faster than the other. The tool at the top of this page reads them differently only because it reports the syntax you typed, not because the schedules differ.

The choice is therefore editorial. A step communicates intent — this is an interval — and one edit changes it. A list communicates fact, and cannot be misread by anyone who has to maintain it at three in the morning.

The mistake that lives next door

Steps behave differently depending on which field they are in, and this is where half-hourly schedules go wrong. Move the same step of thirty into the hour field and it counts hours instead of minutes. Hours run from 0 to 23, so the count starts at midnight and immediately falls off the end of the field. The only value that survives is hour 0.

The result is an expression that looks like it means every half hour, passes every syntax check, installs without complaint, and fires once a day at midnight. Nothing warns you. The only defence is reading the schedule back in words before committing it, which is what the panel above is for.

Where to put the two runs

The top of the hour is the busiest minute on most machines. Listing minutes 15 and 45 gives the same two runs an hour, on the quarters, away from the log rotation and the metrics flush. Constraining the hours as well — a working range on weekdays — takes 48 runs a day down to 18 on five days, which is the right trade whenever the job exists to serve people rather than machines.

Two runs an hour, and what fills the gap

Nothing in the schedule tells the job what happened in the previous thirty minutes, and that is the design decision most half-hourly scripts skip. A job that reprocesses everything each time gets slower as the data grows until one run finally overruns the next. A job that records where it stopped and resumes from there stays the same size forever, whatever the interval. The second shape is what lets you change your mind about the cadence later without rewriting anything.

Choosing the interval honestly

Half an hour is the interval people pick when they have not decided. Ask what happens in the gap: if a stale record for twenty-nine minutes is a real problem, the 15-minute schedule is the answer and doubling the runs is the price. If nothing depends on the freshness at all, an hourly job does the same work for half the cost. When you have the line, read it back with the cron expression generator before it goes anywhere near production.

Frequently asked questions

Which half-hourly form should I commit, the step or the list?

They compile to the same two minutes, so pick for the reader. The step form scales if you later change the interval, since one number moves it. The list form is unambiguous to anyone who has been bitten by step arithmetic before, and it is impossible to misread. On a shared crontab the list usually wins the argument.

Why does a step of 30 in the hour field only fire once a day?

Because the hour field counts hours, and it ends at 23. A step of 30 starting from hour 0 lands on 0 and then runs off the end of the field, so the only surviving value is midnight. The expression is valid, the parser accepts it, and the job you meant to run 48 times a day runs once.

Can I offset a half-hourly job away from the top of the hour?

Yes, and it is usually worth doing. Listing minutes 15 and 45 keeps the thirty-minute gap and puts the job on the quarters instead, clear of everything else on the machine that fires on the hour. The variants above include that form.

Does a half-hourly job need a lock?

If it can ever take longer than thirty minutes, yes. Cron starts the next run on schedule regardless of whether the previous one finished, so a job that occasionally drags will overlap itself. Wrapping it in `flock -n` turns that into a skipped run instead of two concurrent writers.

Related tools

Updated