epochkit

Cron expression for every 6 hours

The cron expression 0 */6 * * * runs on the hour, every 6 hours. The restricted fields are minute 0 and hour */6; the remaining asterisks match anything. That works out to 4 runs per day.

0 */6 * * *

Field breakdown

Field-by-field meaning of the cron expression 0 */6 * * *
Field Value Meaning
Minute 0 The top of the hour (:00)
Hour */6 Every 6 hours, counted from 0: 0, 6, 12, 18
Day of month * Every day of the month (1–31)
Month * Every month (1–12)
Day of week * Every day of the week (0–6)

Next runs

Next 5 runs Timezone: UTC

Run times are calculated in your browser timezone. The scheduler that executes the job uses its own — always UTC on Vercel Cron, UTC by default on GitHub Actions, the host clock on crontab.

How this schedule works

Cron evaluates the five fields of 0 */6 * * * — minute, hour, day of month, month, day of week — against the clock once a minute and starts the job on any minute where all five match, which cronstrue reads as "On the hour, every 6 hours": 4 runs per day. The runs land at 00:00, 06:00, 12:00, 18:00. Twenty-four divides by 6 without a remainder, so the spacing survives midnight: the gap from the 18:00 run to the next day's 00:00 run is the same 6 hours as every other gap.

When to use every 6 hours

Four runs a day carve the day into quarters, which is the natural shape for database backups, bulk index rebuilds, and reports that are regenerated rather than incrementally updated. Six hours gives even a long job room to finish, and the fixed 00:00, 06:00, 12:00 and 18:00 slots make it easy to say which run produced a given artifact. Reach for this cadence when a daily job has grown long enough that splitting it into quarters shortens each run by more than the per-run overhead costs.

Common mistakes with every 6 hours

Six-hourly backups fail quietly in a specific way: the schedule keeps firing, the job keeps exiting zero, and the artifact it wrote is empty. Four runs a day is few enough that nobody notices until a restore is needed. Alert on the size of the output, not on the exit code. The expression-level mistake is the one every step invites — 0 6 * * * is a single daily run at 06:00, not every six hours — and if a reader might make it, the list form 0 0,6,12,18 * * * says the same thing without any ambiguity at all.

Platform snippets

The same expression, ready to paste into the four schedulers that read five-field cron. The notes below each snippet are the ones that follow from this schedule; the cron expression generator lists every caveat for every platform.

GitHub Actions

yaml
name: Scheduled workflow
on:
  schedule:
    - cron: '0 */6 * * *'
  workflow_dispatch:

jobs:
  scheduled:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run job
        run: echo "Running scheduled job"
  • • Workflows scheduled at the top of the hour may be delayed during high-load periods. Consider offsetting the minute field (e.g. "5 */6 * * *") for more reliable timing.

Kubernetes CronJob

yaml
apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-cron-job
spec:
  schedule: "0 */6 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: job
              image: my-image:latest
              command: ["/bin/sh", "-c", "echo Running"]
          restartPolicy: OnFailure

Vercel Cron

json

Hobby plan limitation: cron jobs can only run once per day. Schedules more frequent than daily will fail to deploy on Hobby. Use Pro plan or above for higher frequency.

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "crons": [
    {
      "path": "/api/cron",
      "schedule": "0 */6 * * *"
    }
  ]
}
  • • Pro plan and above: invocations occur within the specified minute (e.g. "5 8 * * *" runs between 08:05:00 and 08:05:59).

crontab

bash
# Edit your crontab: crontab -e
0 */6 * * * /path/to/command

# With logging:
0 */6 * * * /path/to/command >> /var/log/cron.log 2>&1

Variations

Frequently asked questions

How do I read the cron expression 0 */6 * * *?

Read the five space-separated fields left to right as minute, hour, day of month, month, and day of week. In 0 */6 * * * the minute is 0, hour is */6, day of month is *, month is *, day of week is *. Of the operators cron defines, this expression uses only the ones that matter here: an asterisk matches every value in its field and a slash introduces a step counted from the start of the field. Put together, cronstrue reads the whole thing as "On the hour, every 6 hours", and a scheduler that checks all five fields once a minute will start the job 4 runs per day.

What timezone does 0 */6 * * * run in?

The schedule repeats through the day at fixed hours — 00:00, 06:00, 12:00, 18:00 — and which part of the day those hours fall in depends entirely on the scheduler. Moving between zones does not change how often the job runs; it changes when. GitHub Actions defaults to UTC and takes an optional timezone key next to cron, so the hours can be anchored to an IANA zone. Vercel Cron always evaluates in UTC, with no setting to change it. Kubernetes CronJobs use the controller's local zone unless spec.timeZone is set, and a CRON_TZ prefix inside the schedule string is rejected outright. A crontab follows the host clock unless CRON_TZ overrides it. In any zone that observes daylight saving, the whole set of run hours shifts by one twice a year.

Is 0 */6 * * * the same as 0 0,6,12,18 * * *?

Both expressions produce the same four run times a day: 00:00, 06:00, 12:00, and 18:00. The step form is shorter and scales when you change the interval; the list form makes the exact hours obvious to the next reader and lets you pick hours that a step cannot express, such as 1,7,13,19. They stay equivalent only because 6 divides 24 evenly. Whichever form you choose, the hours are evaluated in the scheduler's timezone — always UTC on Vercel Cron, UTC by default on GitHub Actions — so confirm the timezone before assuming a run lands overnight for your team.

Related cron schedules

Build a custom schedule in the cron expression generator, or browse every epochkit tool.