Cron expression for the first of every month

0 0 1 * *

The job runs once a month, at 00:00 on the 1st, twelve times a year. Many crons also accept @monthly.

Runs when: minute 0; hour 0; day of month 1; every month; any day of week.

Change it in the cron expression generator

How the five fields read

FieldValueReads as
Minute0at 0
Hour0at 0
Day of month1at 1
Month*every value
Day of week*every value

The next five runs

What people use it for

There is no "last day of the month"

Standard cron cannot say the last day, and a job set for the 31st skips every month with 30 days or fewer. The usual fix is to run every day and have the script exit unless tomorrow is the 1st. AWS EventBridge does accept L in the day-of-month field for the last day, which cron on Linux does not.

Variations of the first of every month

ExpressionWhat it does
0 6 1 * *The 1st of the month at 06:00.
0 0 1,15 * *Twice a month, on the 1st and the 15th.
0 0 1 */2 *Every other month on the 1st: January, March, May and so on.

The same schedule in four tools

Linux crontab

0 0 1 * * /path/to/command

Add it with crontab -e. It runs in the machine's time zone.

Kubernetes CronJob

spec:
  schedule: "0 0 1 * *"
  timeZone: "Etc/UTC"
  concurrencyPolicy: Forbid

timeZone is stable from Kubernetes 1.27. Without it, the controller's time zone applies. Forbid stops a new run starting while the last one is still going.

GitHub Actions

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

Schedules run in UTC from the default branch, and a run can start a few minutes late when GitHub is busy. Scheduled workflows in public repositories are disabled after 60 days without repository activity.

AWS EventBridge

cron(0 0 1 * ? *)

EventBridge uses six fields, with a question mark in one of the two day fields, and rules run in UTC. Weekday numbers start at Sunday = 1, so names such as MON are safer than numbers.

Questions about the first of every month

How do I run on the last day of the month?
Run daily from the 28th and check tomorrow's date: 0 0 28-31 * * [ "$(date -d tomorrow +\%d)" = 01 ] && /path/to/command (GNU date). On AWS EventBridge, use cron(0 0 L * ? *), because L means the last day.
Is @monthly the same as 0 0 1 * *?
In Vixie cron, yes. Kubernetes CronJobs accept it too, but GitHub Actions and EventBridge do not.

Nearby schedules

Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.