DevToolsmith

Cron Job Every Day at 2 AM

The cron expression 0 2 * * * runs a job every day at 2 AM. Check its next run times below, then copy a ready-made line for crontab, Kubernetes, GitHub Actions, systemd or AWS.

Runs 100% in your browser — nothing is uploaded

Cron schedule

Schedule time zone

UTC

Cron expression for every day at 2 AM

0 2 * * *

At 02:00. It runs once a day, 365 times a year.

02:00 is a popular slot for backups and maintenance because traffic is lowest. It is also the hour most affected by daylight saving time. In the US, clocks jump from 02:00 straight to 03:00 in spring, so 02:00 doesn’t exist that day. cronie runs the skipped job right away, while some other schedulers silently skip it.

Field by field

FieldValueMatches
minute 0 0
hour 2 2
day of month * every value
month * every value
day of week * every value

Examples

crontab

Run crontab -e and add:

0 2 * * * /usr/local/bin/job.sh >> /var/log/job.log 2>&1

Kubernetes CronJob

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-job
spec:
  schedule: "0 2 * * *"
  timeZone: "Etc/UTC"          # Kubernetes 1.27+
  concurrencyPolicy: Forbid    # skip a run if the last one is still going
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: job
              image: ghcr.io/acme/job:1.0
          restartPolicy: OnFailure

GitHub Actions

on:
  schedule:
    - cron: '0 2 * * *'   # UTC

GitHub evaluates schedules in UTC, and runs can start several minutes late at busy times.

systemd timer

# /etc/systemd/system/job.timer
[Unit]
Description=Run job.service every day at 2 AM

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target

Enable it with systemctl enable --now job.timer, and check the next runs with systemd-analyze calendar "*-*-* 02:00:00". Persistent=true runs a missed job after downtime, which cron can’t do.

AWS EventBridge

cron(0 2 * * ? *)

EventBridge cron has six fields (the last is the year), uses ? in either the day-of-month or the day-of-week field, and numbers weekdays from 1 (Sunday) to 7. Rules run in UTC; EventBridge Scheduler also accepts a time zone.

Similar schedules: daily

Have a different schedule? Paste any expression into the Cron Expression Generator, or browse all cron examples.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

How do I run a cron job every day at 2 AM?

Use 0 2 * * *. It means “At 02:00”. It runs once a day, 365 times a year.