Sign up free

Cron · Every 6 hours

Cron every 6 hours

crontab schedule
0 */6 * * *

Runs at 00:00, 06:00, 12:00 and 18:00, 4 times a day.

What it means

  1. minute0minute 0
  2. hour*/6every 6th hour: 0, 6, 12, 18
  3. day of month*every day
  4. month*every month
  5. day of week*every day of the week

Next runs

    Cron uses the server's time zone. Most servers run in UTC; check with date on the server.

    When to use it

    Every 6 hours suits backups of busy databases, price and stock syncs, and anything that should run a few times a day without anyone waiting on it.

    Variations

    • 0 0,6,12,18 * * *: the same, written out.
    • 30 1-23/6 * * *: at 01:30, 07:30, 13:30 and 19:30.

    Common mistakes

    • * */6 * * * runs every minute during hours 0, 6, 12 and 18 (60 times each). The minute field must be a number.
    • Day of month and day of week together. If both are set (not *), standard cron runs when either matches, not both. 0 0 13 * 5 runs on every 13th and every Friday.
    • The job runs, but fails. Cron only starts the command. Exit codes and errors go to local mail or nowhere. Add && before the ping so a failed job doesn't ping.
    • Environment. Cron runs with a minimal PATH and no shell profile. Use full paths in the command.

    On other platforms

    • GitHub Actions (on: schedule): Same 5-field syntax, in UTC by default. The shortest interval is 5 minutes, and runs can start late under load. GitHub docs
    • Kubernetes CronJob: Same 5-field syntax. Set the time zone with .spec.timeZone (stable since v1.27), not with CRON_TZ in the schedule. Kubernetes docs
    • Vercel Cron Jobs: Hobby runs at most once a day, timed within the hour. Pro can run every minute. Vercel docs

    Know when it stops running

    crontab
    0 */6 * * * /path/to/your-job.sh && curl -fsS -m 10 https://<your heartbeat URL> > /dev/null
    Expected every
    6 hours
    Grace
    30 minutes
    Monitor this job

    Heartbeat monitors are on Pro ($15 a month, or $12 billed yearly) and Agency. Free covers website, keyword, ping and port checks.

    Questions

    What's the cron for every 6 hours?

    0 */6 * * *.

    Why does my 6-hourly job run 60 times?

    The minute field is *. Set it to 0.

    Can I start it at 03:00 instead of midnight?

    0 3-23/6 * * * runs at 03:00, 09:00, 15:00 and 21:00.