How to run a cron job every 5 minutes
The correct expression in all four dialects, the mistake that quietly drifts, and what to do about overlapping runs.
Frequently asked questions
What is the cron expression for every 5 minutes?
*/5 * * * * in standard cron. In node-cron, 0 */5 * * * *. In Quartz, 0 0/5 * * * ?. In AWS EventBridge, cron(*/5 * * * ? *). They differ because the field counts and the day-field rules differ, not because the schedule does.
Does */5 run exactly every 5 minutes?
It fires at :00, :05, :10 and so on — aligned to the clock, not to when you deployed. The gaps are exactly 5 minutes because 5 divides 60. A step that does not divide 60 evenly leaves a short gap at the top of each hour: */7 fires at :56 and then :00, four minutes later.
What is the difference from AWS rate(5 minutes)?
rate() counts from when the rule was created, so it drifts relative to the clock and two rules created a minute apart fire a minute apart forever. cron(*/5 * * * ? *) fires on the clock. Use rate() when the interval matters and cron() when the wall-clock time matters.
Can I run a job every 5 seconds with cron?
Not in standard cron, which has no seconds field — one minute is the finest resolution. node-cron and Quartz both add seconds, so */5 * * * * * works there. But at that frequency a scheduler is usually the wrong tool: a long-running process with its own timer avoids the process start-up cost you would pay 17,280 times a day.
Why is my every-5-minutes job overlapping itself?
Because cron starts a new run on schedule regardless of whether the previous one finished. If a run occasionally takes six minutes, you get two copies. Take a lock inside the job — a file lock, a database row, or flock on Unix — rather than assuming the schedule prevents it.
Found a mistake on this page? Tell me — a page that is confidently wrong is worse than no page.