- Home
- Tools
- Developer Tools
- Cron Expression Explainer
- Cron Expression for Every 5 Minutes
Cron Expression for Every 5 Minutes
*/5 * * * * runs a job every five minutes on the clock: at :00, :05, :10 and so on. Edit it below and see the run times change.
Every 5 minutes
| Field | Value | Matches |
|---|---|---|
| Minute | */5 | every 5th minute from 0 to 55 |
| Hour | * | every hour |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | * | every day of the week |
Next 10 runs
Cron goes by the clock of the machine it runs on. These are the runs on a machine in your time zone.
What the slash does
In */5 * * * * the first field does the work. */5 there means every fifth minute, counted from 0: minutes 0, 5, 10 and so on up to 55. With the other four fields left as * that comes to 288 runs a day.
| Expression | Runs |
|---|---|
| */5 * * * * | Every 5 minutes |
| 5 * * * * | At minute 5 of every hour |
| 2-59/5 * * * * | At every 5th minute from 2 to 57 of every hour |
| */5 9-17 * * 1-5 | Every 5 minutes from 09:00 to 17:55 on Monday to Friday |
The mistake that is made most
5 * * * * looks almost the same and runs once an hour, at five past. Without the slash, a number is a moment and not an interval.
The runs follow the clock
The job starts at 10:00, 10:05, 10:10, and not five minutes after you saved the crontab or after the last run ended. Two things follow from that.
A run that takes longer than five minutes is still going when the next one starts. If that would do harm, put flock -n /tmp/job.lock in front of the command, so that a run is skipped while the previous one is busy.
And every machine with this line fires at the same second. When many of them call the same service, spread them out with an offset, as 2-59/5 in the table does: the interval is the same, only the minutes are 2, 7, 12 and onwards.
The cron expression explainer has the full syntax: the five fields, lists, ranges and steps, and how day of month and day of week work together.