DEV Community

Cover image for How do I set cron on minute 5 and 35?
Ameen Usman
Ameen Usman

Posted on

How do I set cron on minute 5 and 35?

Search logs keep asking a narrow question: how do I set cron on minute 5 and 35? Those two clock marks are not a mystery schedule. On a normal five-field crontab they already appear inside the every-five-minutes step.

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

Build the same string in the browser generator if you want a plain-English check first: https://kepttools.com/cron-generator — then copy the five fields into the crontab on the machine that will run it. The page does not install the job.

What */5 actually fires

*/5 in the minute field means every five minutes, locked to the clock—not to the minute you saved the file. The full line is:

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

The guide’s minute list is exact:

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

Minute 5 and minute 35 are both on that list. Twelve runs an hour. If you installed the line at 10:03, the next run is 10:05, then 10:10—the schedule does not remember when you edited the file.

Worked example (real output from the guide)

Compare the step family the guide prints:

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

If you typed “cron on minute 5 and 35” because you saw those times in logs, */5 * * * * is the expression that includes them. If you wanted a half-hour pulse, */30 * * * * is 0 and 30—not 5 and 35. That mismatch is a common reason the search query shows up.

A related trap: 5-59/5 * * * * starts the range at 5, so minute 0 is skipped. Use that only when you really want to skip the top of the hour. For a plain “every five minutes,” keep */5 * * * *.

Prove it for one cycle

Point a throwaway line at a file you can delete:

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

Wait until two lines have been written. The minutes should be five apart, and each minute should be divisible by 5—so when the clock passes :05 or :35, those stamps belong in the log. Then delete the line. Use journalctl -u cron or syslog, whichever your host actually keeps.

Five fields, no seconds

A standard crontab line has five time fields, then the command. Nothing in those five fields is a seconds field. The daemon starts the command once when the minute begins. It does not repeat at second 10, 20, and so on inside the same minute.

Copy the five fields, not the English sentence beside them. Crontab has no use for the words “every five minutes.”

Honest limit (one line)

Limit: the generator and this guide build and explain a five-field expression; they do not install the job, do not simulate your daemon’s calendar, and */5 will not start “five minutes from now”—use sleep or a queue delay for that.

Also stay inside five-field cron when you paste: Quartz and EventBridge use six-field shapes (and ? in a day field). systemd timers use OnCalendar—do not paste */5 * * * * into a timer unit. Traditional Vixie cron will not skip a run because the previous process is still going; a six-minute job on */5 can overlap itself unless you take a lock such as flock inside the command.

When the search question is answered

You asked for cron on minute 5 and 35. Those minutes are in the */5 clock list. Confirm with the log test, copy only the five-field string, and keep verification on the host that will run it.

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

Top comments (0)