Xerobit

Cron Every Day at Midnight: 0 0 * * *

The cron expression for every day at midnight is 0 0 * * *. It runs 1 time per day, and the table below explains every field.

  • Cron expression
    0 0 * * *
  • Schedule
    every day at midnight
  • Runs per day
    1
  • Runs per 30 days
    30
  • systemd OnCalendar
    daily
  • AWS EventBridge
    cron(0 0 * * ? *)

What 0 0 * * * means

FieldValueMeaning
Minute0at minute 0
Hour0at hour 0 (midnight)
Day of month*every day
Month*every month
Day of week*every day of the week

The five fields of a standard cron expression are, in order: minute, hour, day of month, month and day of week.

When every day at midnight runs

The first run times in a day are: 00:00. Over time that is 1 per day, 7 per week, about 30 per 30 days and 365 per year.

Copy-ready syntax for every day at midnight

crontab

0 0 * * * /path/to/script.sh >> /var/log/job.log 2>&1

GitHub Actions

on:
  schedule:
    - cron: '0 0 * * *'

GitHub Actions runs scheduled workflows in UTC and may start them a few minutes late when GitHub is busy.

Kubernetes CronJob

apiVersion: batch/v1
kind: CronJob
spec:
  schedule: "0 0 * * *"
  concurrencyPolicy: Forbid

Setting concurrencyPolicy: Forbid stops a new run from starting while the previous one is still going.

systemd timer

[Timer]
OnCalendar=daily
Persistent=true

AWS EventBridge

cron(0 0 * * ? *)

EventBridge cron has six fields and needs a ? in either the day-of-month or the day-of-week field. The simpler rate(1 day) form works for fixed intervals.

When to use every day at midnight

Financial institutions generate daily account statements and calculate interest accruals precisely at midnight. System administrators also schedule full database backups and log archival processes to run during this low traffic maintenance window.

What can go wrong

Midnight is a popular default, so many unrelated jobs compete for resources simultaneously on the same host. This concentration causes severe disk contention and network bottlenecks, often pushing critical backups past their safe completion windows.

Cron uses the time zone of the machine or service running it, so check whether that is UTC or local time before you rely on the clock times above.

Other common schedules

FAQ

What is the cron expression for every day at midnight?

Use 0 0 * * *. It is the standard five-field form accepted by Linux crontab, Kubernetes CronJobs and GitHub Actions.

How many times a day does 0 0 * * * run?

1 time per day, or 30 over 30 days.

How do I test a cron expression?

Build it in the cron builder, which explains each field in plain English and lists the next run times.

More cron