Skip to main content

0 0 */5 * * is not every date divisible by 5

On Vixie cron and cronie the day step starts at 1. Midnight lands on the 1st, 6th, 11th, 16th, 21st, 26th, and 31st.

Updated 2 min readMarkdown
0 0 */5 * * is not every date divisible by 5

0 0 */5 * * looks like midnight every five days. On Vixie cron and cronie it is midnight on the 1st, 6th, 11th, 16th, 21st, 26th, and 31st. It is not the 5th, 10th, 15th, 20th, 25th, and 30th.

The day-of-month field starts at 1. A star there means 1-31. A step of five walks that range from 1. The minute field starts at 0, which is why */5 in minutes includes minute 0 and feels simpler.

*/5 * * * *     # 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
0 0 */5 * *     # 1st, 6th, 11th, 16th, 21st, 26th, 31st

Test before you trust another daemon

This list is the documented shape for Vixie cron and cronie. If the host is not cronie, confirm the dates on that system. The cron expression generator will show you the five fields. It will not simulate every calendar implementation.

Do not paste the line into Quartz, Spring, EventBridge, or a systemd timer and expect the same meaning. Those use different languages. systemd timers use OnCalendar; check with systemd-analyze calendar on that machine.

Copy numbers, not English. Use an absolute path for the command. Cron’s PATH is often shorter than your login shell.

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

No comments yet. Be the first to comment.