TechCompare LogoTechCompare

How to run a cron job every 5 minutes: the */5 syntax explained

*/5 * * * * is correct for most every-5-minute use cases. Add locking if the job runtime might exceed the interval. For sub-minute scheduling, cron is the wrong tool. Use a daemon or systemd timer instead.

Running a cron job every 5 minutes uses the step operator in the minute field: */5 * * * *. The */5 means every 5th minute. At the top of each hour the job fires at :00, :05, :10, and so on. This is the standard pattern for health checks, metric collection, and near-real-time polling.

By TechCompare · Updated

Schedule pattern
Every 5 minutes
every-5-minutes
Category
Common Patterns
Standard cron expression patterns

How this is calculated

The slash operator divides the range (0-59 for minutes) into steps. */5 is shorthand for 0,5,10,15,20,25,30,35,40,45,50,55. If you need offset timing (e.g. :02, :07, :12), list the values explicitly: 2,7,12,17,22,27,32,37,42,47,52,57. Be aware that running a job every 5 minutes means 288 executions per day. If the job takes more than 5 minutes to complete, overlapping runs can cascade. Add a lock file or use flock to prevent concurrent execution.

Verdict

The step operator turns one expression into 288 daily runs, so locking matters more than the syntax does. */5 expands to minutes 0,5,10,15 through 55 at the top of the range, and you can shift offset timing by listing values like 2,7,12 explicitly. If a single run ever exceeds five minutes, you'll get cascading overlap unless flock or a lock file gates it.

More Cron scenarios

Frequently asked questions

How do I run a cron job every 5 minutes?
Use */5 in the minute field: */5 * * * *. The step operator divides the 0-59 minute range into fifths, so the job fires at :00, :05, :10, and so on through :55. This is the standard pattern for health checks, metric collection, and near-real-time polling.
How many times a day does a */5 cron job run?
288 times per day. That's fine for a lightweight health check, but it means a slow job can pile up. If a single run ever takes longer than 5 minutes, the next invocation starts while the previous one is still going, which can cascade into overlapping runs. Guard it with flock or a lock file.
What if cron every 5 minutes overlaps with the previous run?
Wrap the command with flock: */5 * * * * flock -n /tmp/myjob.lock /path/to/script. The -n flag makes the new invocation exit immediately if the old one still holds the lock. Without some form of locking, a job whose runtime grows past 5 minutes will eventually stack up copies of itself and starve the machine.