Cron every 2 minutes: */2 * * * *
*/2 * * * * runs on every even minute, 30 times an hour and 720 times a day. Odd minutes need 1-59/2 instead.
At a glance
- Expression
- */2 * * * *
- Fires
- 720 times a day, 30 times an hour.
- Restricted fields
- Minute only. Hour, day of month, month and day of week are all open.
- Equivalent macro
- None.
- Minutes matched
- 0, 2, 4, 6 ... 58. Thirty values, all even.
- Odd minute equivalent
- 1-59/2 matches 1, 3, 5 ... 59.
In detail
A step is applied from the bottom of the field, and the minute field starts at 0, so */2 lands on even minutes and never on odd ones. That is not a rounding artefact, it is the definition: the parser walks 0, 2, 4 up to 59 and collects every value it touches. If you want the odd half of the clock you have to say so with an explicit range, 1-59/2, which starts the walk at 1 instead.
Two minutes is short enough that the previous run may still be going. Unlike a once a minute job the odds are better, but the failure is sneakier: the job runs fine for weeks, then one slow day it crosses the two minute mark and you get overlapping writes with no obvious cause. Wrapping the command in a lock costs nothing and removes the whole class of problem.
Everything on the machine that uses */2 fires at the same instant, and so does everything using */2 on every other machine whose clock is synchronised. If the job talks to a shared API or database, moving to 1-59/2 halves the number of processes hitting it at exactly the same moment for no change in frequency.
During the hour that repeats at the end of daylight saving time, a minute based schedule like this one runs 30 extra times, because the wall clock passes through the same minutes twice. During the hour that is skipped in spring it loses 30 runs. Neither matters for an idempotent check, and both matter a lot for anything that appends to a ledger.
Examples
*/2 * * * *1-59/2 * * * *Same 720 runs a day, offset by one minute from everything else on the box.
*/2 * * * * /usr/bin/flock -n /tmp/sync.lock /opt/app/bin/sync.sh >> /var/log/sync.log 2>&1Things that catch people out
- */2 in the day of month field does not mean the same thing, because that field starts at 1, so it gives odd numbered days.
- Writing 0-58/2 is identical to */2 for minutes, but 0-59/2 is too, because the walk never reaches 59 from an even start. Both are just noise around */2.
- Two crontab lines with */2 and 1-59/2 do not give you a job every minute in a useful sense, they give you two independent jobs. If you want one job every minute, say * * * * *.
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 minute: * * * * *
* * * * * fires 1,440 times a day, once at the top of every minute. Why it is the fastest a five field crontab goes, and how to stop runs stacking.
Cron every 3 minutes: */3 * * * *
*/3 * * * * fires 480 times a day at minutes 0, 3, 6 and so on to 57. Why 3 divides the hour cleanly and what that means for scheduling.
Cron every 5 minutes: */5 * * * *
*/5 * * * * fires 288 times a day at minutes 0, 5, 10 and so on. Why every job on the box lands on the same minute and how 2-59/5 fixes it.
Cron step values: what */n really does
*/n walks a field from its minimum in increments of n. Because it starts at the field minimum, */2 gives even minutes and odd days of the month.
Cron every 10 minutes: */10 * * * *
*/10 * * * * fires 144 times a day at minutes 0, 10, 20, 30, 40 and 50. Run counts, offset variants and the rate limit maths that make it popular.
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.
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