DEV Community

Cover image for Can I start cron every 5 minutes from now?
Ameen Usman
Ameen Usman

Posted on

Can I start cron every 5 minutes from now?

The search question is blunt: can I start cron every 5 minutes from now? With */5, the answer is no. The step is locked to the clock. Cron does not start a private five-minute timer from the second you save the file.

Guide: https://kepttools.com/guides/cron-every-5-minutes

What */5 actually means

*/5 * * * *
Enter fullscreen mode Exit fullscreen mode

In the minute field, * is shorthand for 0–59, and /5 steps by five. The runs are:

0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
Enter fullscreen mode Exit fullscreen mode

Twelve starts every hour. Build the same string in the cron expression generator if you want a plain-English check. The page does not install the job. Copy the five fields—not the sentence beside them.

Worked example

You install the line at 10:03.

Expectation Reality on classic cron
First run at 10:08 (“five minutes from now”) First run at 10:05, then 10:10

The schedule does not remember when you edited the crontab. It only matches clock minutes divisible by five (including 0).

If you truly need “five minutes from this moment”

The guide is direct: not with */5. Sleep inside a process, or use a queue’s delay. Cron will still wake on 0, 5, 10, and the rest for any */5 line you leave installed.

Related traps (same guide)

  • 5-59/5 * * * * skips minute 0 because the range starts at 5. Use it only when you mean that. Plain every five minutes stays */5 * * * *.
  • Five-field cron has no seconds field. The daemon starts once when the minute begins; it does not re-fire at second 10 inside that minute.
  • Do not paste */5 * * * * into a systemd OnCalendar unit. Different language—check with systemd-analyze calendar on that host.
  • Classic cron will not wait for a long job to finish before the next tick; that is a separate overlap problem (lock the command if needed).

Honest limit

Limit: the generator and guide explain a five-field expression; they do not install the job, do not delay “from now,” and do not simulate your daemon’s calendar.

Prove the clock grid

*/5 * * * * date >> /tmp/cron-every-5.log
Enter fullscreen mode Exit fullscreen mode

Wait for two lines. Minutes should be five apart and divisible by 5. Then delete the line.

Timezone and paths (brief)

Fields follow the daemon’s timezone. Midnight is midnight there, not necessarily UTC. Call programs by absolute path—cron’s PATH is often short. If an API stores “next run” as a Unix timestamp, read that number with a timestamp converter; do not paste the epoch into the minute field.

Closing

Want every five minutes on the clock? Use */5 * * * *. Want five minutes from an arbitrary instant? That is sleep or a queue—not a cron step pretending to be a stopwatch. Say the requirement out loud before you edit crontab: “clock grid” and “from now” are different tickets.

Full walkthrough: https://kepttools.com/guides/cron-every-5-minutes

Top comments (4)

Collapse
 
hongke_shop profile image
HONGKE •

Helpful question, I have wondered about this too. Thanks for laying out the options clearly!

Collapse
 
ameenusman profile image
Ameen Usman •

@hongke_shop Thanks — glad it helped. The clock-grid vs “from now” mix-up is super common; sleep or a queue delay usually clears it up once you name which one you actually need.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

5-59/5 skips minute 0. the range starts at 5, so the first run of the hour never happens.

Collapse
 
ameenusman profile image
Ameen Usman •

Exactly — 5-59/5 starts the range at 5, so minute 0 is out. First run of the hour is :05, then :10, … through :55.

That’s intentional only when you want to skip the top of the hour. For plain “every five minutes,” stick with */5 * * * * (which includes 0). Easy to mix up because both look like “step by five.”

I wrote the clock list and that trap here: kepttools.com/guides/cron-every-5-...