Why */7 in cron is not every 7 minutes
A job set to */7 runs at 9:49, 9:56, then 10:00: four minutes, not seven. Nothing is broken. A step in cron counts within its field, and starts again from the beginning of the field every time round.
Written · Updated
In cron, a step such as */7 means every 7th value of the field, counted from its start, and the count starts again each time the field does. In the minute field */7 is minutes 0, 7, 14 and so on to 56, then 0 again, so the last gap of every hour is 4 minutes. Only a step that divides 60 evenly (1, 2, 3, 4, 5, 6, 10, 12, 15, 20 or 30) gives an even interval. Cron alone cannot run something every 7 minutes; run it every minute and let the command decide.
What a step means
A field written */n is the field’s whole range, 0 to 59 for minutes or 0 to 23 for hours, taking every nth value from the start. It describes a set of minutes in each hour, not an interval between runs. When the hour turns over the set starts again, whatever happened at the end of the last one.
The runs of each line from 9:40 one morning, as CRON lists them:
| Line | Runs | The uneven gap |
|---|---|---|
*/7 * * * * | 9:42, 9:49, 9:56, 10:00, 10:07, 10:14 | 4 minutes, from :56 to :00 |
*/25 * * * * | 9:50, 10:00, 10:25, 10:50, 11:00 | 10 minutes, from :50 to :00 |
*/15 * * * * | 9:45, 10:00, 10:15, 10:30 | None: 15 divides 60 |
0 */5 * * * | 10:00, 15:00, 20:00, 00:00, 05:00 | 4 hours, from 20:00 to midnight |
0 */7 * * * | 14:00, 21:00, 00:00, 07:00 | 3 hours, from 21:00 to midnight |
The hour field works the same way over 24: a step gives an even interval only if it divides 24 (1, 2, 3, 4, 6, 8 or 12). In the day of the month, */2 is the odd days, 1 to 31, so a 31-day month runs on the 31st and again on the 1st.
Starting somewhere other than :00
A range with a step starts at the range: 5-59/15 is :05, :20, :35 and :50, which keeps a job off the top of the hour, where everything else runs. Many crons also accept 5/15 to mean the same, but not all of them read a single number before a slash that way; 5-59/15 is understood everywhere.
How to run something every 7 minutes
Run the line every minute and let the command go ahead only when the minutes since 1970 divide by 7:
* * * * * [ $(( $(date +\%s) / 60 \% 7 )) -eq 0 ] && /usr/local/bin/job
The backslashes before % are needed because an unescaped % ends the command in a crontab. On a machine with systemd, a timer with OnUnitActiveSec=7min runs a service seven minutes after it last started, which is an interval rather than a set of clock times.
Checking a line before it goes live
Paste the five fields into CRON. When a step does not divide its field, the plain-English line says so and gives the short gap, as in “every 7th minute of the hour, from :00 to :56, so the gap across the hour is 4 minutes, not 7”, and the list of next runs shows it happen. For why a job runs on extra days when both day fields are set, see cron’s day-of-month and day-of-week rule.
Questions people ask about cron step values
Does */7 in cron run every 7 minutes?
No. It runs at minutes 0, 7, 14 and so on to 56 of every hour, then at :00 again, so the last gap of each hour is 4 minutes. Only steps that divide 60 evenly give an even interval.
Which cron minute steps are evenly spaced?
1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30, the numbers that divide 60. In the hour field it is 1, 2, 3, 4, 6, 8 and 12, which divide 24.
What does 5/15 mean in cron?
Minutes 5, 20, 35 and 50 in crons that accept it, which most do. Write 5-59/15 to be understood by every one of them.
How do I run a cron job every 7 minutes?
Run it every minute and let the command go ahead only when the minutes since 1970 divide by 7: [ $(( $(date +\%s) / 60 \% 7 )) -eq 0 ] && job. A systemd timer with OnUnitActiveSec=7min is the other way.
Why does my */5 hour job run at midnight and then 4 hours later?
Because */5 in the hour field is 0, 5, 10, 15 and 20, and the count starts again at midnight. The gap from 20:00 to 00:00 is 4 hours.
Related tools
- How to prove you did not use AI to write somethingNo test can prove a text was not written with AI. What you can show is how it was written: drafts, history and a timestamped record of the process.
- Why a regex works in regex101 but not in JavaScriptregex101 starts on PCRE, and JavaScript is another engine. The syntax it lacks, two escapes that fail silently, and the escaping that breaks a pattern in code.
- JWT kid not found in the JWKSThe token names a signing key the published key set does not have: usually a key rotation, a stale cache, or another issuer.
- Falsely accused of using AI: what to doAccused of using AI on work you wrote yourself? What a detector score does and does not show, what to ask for, and the evidence you can give.
- A record of your writing process that you keepA tamper-evident, timestamped record of how a piece of writing was made, kept on your device, in a file anyone can check for free.
What your files give away
A one-page checklist of what a photo, a document or a PDF says about you, free now. Then one letter a month, with one new tip.