The expression is <code>0 */6 * * *</code>. Four runs a day: midnight, 6 AM, noon, 6 PM. Below we break down exactly why, show you how to shift the offset, and cover the one mistake that turns four daily runs into 240.
How 0 */6 * * * works#
Five cron fields, left to right: minute, hour, day of month, month, day of week. The */6 is a step value in the hour field. It tells cron to fire every sixth hour starting from zero. So hours 0, 6, 12, 18.
The 0 in the minute field pins execution to the top of each hour. Drop it and write * */6 * * *, and cron fires every minute during those four hours. That's 240 runs a day instead of 4. We've seen this exact mistake on staging servers where someone copied the expression from a forum post that omitted the minute field. The database backup script ran 60 times in an hour before anyone noticed.
Quick sanity check: */6 is shorthand for the explicit list 0,6,12,18. Both produce identical schedules. You can build and verify the expression before deploying, or run it through the validator to confirm the next five execution times.
Setting up crontab every 6 hours#
Open the crontab editor:
crontab -e
Add the job with absolute paths. Cron doesn't load your shell profile, so python3 alone won't resolve:
0 */6 * * * /usr/bin/python3 /opt/scripts/sync-inventory.py >> /var/log/inventory-sync.log 2>&1
Confirm the entry:
crontab -l
Three things to get right:
- Absolute paths.
/usr/bin/python3, notpython3. Find yours withwhich python3. - Output redirection. Without
>> logfile 2>&1, cron tries to email output via sendmail. On most servers that's not configured, so output silently vanishes. - No interactive prompts. Cron has no terminal. Anything expecting user input hangs indefinitely.
Shifting the offset#
What if you don't want midnight as the starting point? Maybe your team runs a deploy at midnight and you'd rather the sync happen at 2 AM, 8 AM, 2 PM, 8 PM. Replace the step with an explicit list:
0 2,8,14,20 * * *
Or if you want 6-hour spacing starting at 3 AM:
0 3,9,15,21 * * *
The */6 shorthand always starts from 0, there's no way to offset it with step syntax alone. You have to spell out the hours. Not elegant, but it works. Anyone reading the crontab immediately sees the exact run times.
Restricting to specific days#
Need 6-hourly runs only on weekdays? Add the day-of-week field:
0 */6 * * 1-5
Monday through Friday, four runs each day. Weekends, nothing. But here's a gotcha: if your job produces output that downstream processes expect on Monday morning, the 54-hour gap between Friday 18:00 and Monday 00:00 can cause stale data. Think about whether the gap matters before restricting days.
Why 6 divides cleanly (and why it matters)#
Six divides 24 evenly. Four runs, equally spaced across the day. What happens with values that don't divide cleanly? Try */7 in the hour field and you get hours 0, 7, 14, 21. Still four runs, but with a 3-hour gap between 21:00 and 00:00. Try */5 and you get 0, 5, 10, 15, 20. Five runs, but a 4-hour gap between 20:00 and 00:00. So uneven spacing means uneven load. For batch jobs that aggregate data, one period ends up processing significantly more records than others.
Clean divisors of 24: 1, 2, 3, 4, 6, 8, 12. Stick to these for evenly spaced hourly intervals. If you need a different interval, see our guide on cron every 2 hours or the full cron jobs overview.
Common use cases for cron every 6 hours#
A cron job every 6 hours hits a practical sweet spot: frequent enough to keep data reasonably fresh, infrequent enough to avoid hammering APIs or databases. We see it most often on inventory syncs between warehouses and storefronts, report generation for dashboards that don't need real-time data, cache warming for heavy pages, and DNS record propagation checks.
How often do these actually fail? More than you'd expect. An API changes its rate limit, a disk fills up, a credentials file gets rotated without updating the script. Four runs a day means a failure can sit unnoticed for 6 hours before the next attempt.
Monitoring a cron job every 6 hours#
A job that runs four times a day is easy to lose track of. It fails at noon, nobody checks until the next morning, and by then you've missed two cycles. The log file helps, but only if someone reads it.
Cron job monitoring catches this automatically. Your script pings a URL on success, and WatchCron alerts you if the ping doesn't arrive within the expected window. Set the schedule to 0 */6 * * * and the grace period to 10-15 minutes, and any missed run triggers a notification through Slack, email, Telegram, or 16 other channels. In our dashboard, we flag 6-hour schedules that miss even a single ping because one missed cycle already means stale data for a quarter of the day.
And if you don't have a server at all, Cloud Cron can run the HTTP request for you on a 6-hour schedule. It handles the scheduling and the monitoring in one step.
Frequently asked#
The expression is 0 */6 * * *. It runs at hours 0, 6, 12, and 18, four times per day. The leading 0 sets the minute to the top of the hour.
Use an explicit hour list instead of the step syntax. For example, 0 2,8,14,20 * * * runs every 6 hours starting at 2 AM. The */6 shorthand always starts from hour 0 and can't be offset.
The * in the minute field means "every minute." Combined with */6 in the hour field, cron runs every minute during hours 0, 6, 12, and 18. That's 240 executions per day instead of 4. Always set the minute field to a specific value like 0.
The clean divisors are 1, 2, 3, 4, 6, 8, and 12. Using these values with the step operator (e.g., */6) gives evenly spaced runs with no awkward gaps between the last run and midnight.
Run crontab -e and add 0 */6 * * * /path/to/your/script.sh. Use absolute paths for both the interpreter and the script. Redirect output with >> /var/log/job.log 2>&1 to capture errors.