Variations
| Schedule | Expression |
|---|---|
| Every 30 minutes (:00 and :30) | */30 * * * * |
| Every 30 minutes at :15 and :45 | 15,45 * * * * |
| Every 30 minutes from 08:00 to 18:30 | */30 8-18 * * * |
| Every 30 minutes on weekdays | */30 * * * 1-5 |
| Every 20 minutes | */20 * * * * |
Why */45 doesn't mean every 45 minutes
A step like */45 restarts every hour: it means minutes 0 and 45, so the job runs at :00, :45, then :00 again 15 minutes later. Steps only give even intervals when they divide 60: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30.
Paste */45 * * * * into the tool above to see the uneven run times.
Where the half-hour cutoff falls
*/30 8-18 * * * runs at 08:00 and the last run is 18:30, because the hour range includes all of hour 18. To stop at 18:00, add a separate line 0 18 * * * and use */30 8-17 * * *.
Frequently asked questions
Is */30 the same as 30?
No. 30 * * * * runs once an hour at minute 30. */30 * * * * runs twice an hour, at minutes 0 and 30.
How do I run a job every 30 seconds?
Cron's smallest unit is a minute. A common trick is two crontab lines, one plain and one starting with sleep 30;, or a systemd timer with OnUnitActiveSec=30s.
Will runs overlap if the job takes longer than 30 minutes?
Yes, cron starts the next run regardless. Use flock -n /tmp/job.lock command so a second copy exits while the first is still running.