T
ToolPrime

Cron Expression for the First Monday of Every Month

Run a cron job on the first Monday of each month using 0 0 1-7 * 1. This works because the first Monday always falls between the 1st and 7th.

Expression

0 0 1-7 * 1

At 00:00 on Monday if the day is between the 1st and 7th

Use Cases

Code Examples

Crontab

# At 00:00 on Monday if the day is between the 1st and 7th
0 0 1-7 * 1 /path/to/your/script.sh

GitHub Actions

name: Scheduled Job
on:
  schedule:
    - cron: '0 0 1-7 * 1'
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Running First Monday of Every Month"

systemd Timer

[Unit]
Description=First Monday of Every Month timer

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

[Install]
WantedBy=timers.target

Tips

Frequently Asked Questions

Does 0 0 1-7 * 1 run only on the first Monday?

It depends on the cron implementation. In standard Vixie cron, day-of-month and day-of-week are ORed, meaning it runs on days 1-7 AND on every Monday. For strict first-Monday behavior, add a script check: [ "$(date +\%u)" = "1" ] && [ "$(date +\%d)" -le 7 ].

Is there a simpler way to schedule the first Monday?

Some scheduling systems like AWS EventBridge and Quartz support first weekday syntax (e.g., 1#1 for first Monday). In standard cron, you need the wrapper script approach.

Related Cron Expressions