DevToolsmith

Cron Job on the First Monday of the Month

Standard cron can’t express “On the first Monday of the month” in a single expression. Here is the closest schedule, 0 9 1-7 * *, plus the workaround that fills the gap and copy-ready examples.

Runs 100% in your browser — nothing is uploaded

Cron schedule

Schedule time zone

UTC

Closest cron expression

0 9 1-7 * *

At 09:00, between day 1 and 7 of the month. On its own, it runs on 84 days a year.

The obvious expression, 0 9 1-7 * 1, is wrong. When both day fields are set, cron runs when EITHER one matches, so it would run on days 1–7 AND on every Monday. Instead, schedule days 1–7 and check the weekday in the command. systemd timers combine the fields with AND, so OnCalendar=Mon *-*-01..07 09:00:00 works there directly.

Workaround: run a job on the first Monday of the month

date +%u prints the weekday as 1 (Monday) to 7 (Sunday). Change the 1 to pick another weekday.

crontab
0 9 1-7 * * [ "$(date +\%u)" = "1" ] && /usr/local/bin/job.sh

The same idea works on every scheduler below: keep the base schedule and put the check at the start of the job’s command or script.

Field by field

FieldValueMatches
minute 0 0
hour 9 9
day of month 1-7 1–7
month * every value
day of week * every value

Examples

crontab

Run crontab -e and add:

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

For the exact schedule, use the workaround line above instead.

Kubernetes CronJob

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-job
spec:
  schedule: "0 9 1-7 * *"
  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 9 1-7 * *'   # 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 on the first Monday of the month

[Timer]
OnCalendar=*-*-01..07 09: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 "*-*-01..07 09:00:00". Persistent=true runs a missed job after downtime, which cron can’t do.

AWS EventBridge

cron(0 9 1-7 * ? *)

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: monthly and yearly

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 on the first Monday of the month?

No single standard cron expression does this exactly. The obvious expression, 0 9 1-7 * 1, is wrong. When both day fields are set, cron runs when EITHER one matches, so it would run on days 1–7 AND on every Monday. Instead, schedule days 1–7 and check the weekday in the command. systemd timers combine the fields with AND, so OnCalendar=Mon *-*-01..07 09:00:00 works there directly. date +%u prints the weekday as 1 (Monday) to 7 (Sunday). Change the 1 to pick another weekday. 0 9 1-7 * * [ "$(date +\%u)" = "1" ] && /usr/local/bin/job.sh