Cron expression for every Monday
0 9 * * 1The job runs once a week, on Monday at 09:00.
Runs when: minute 0; hour 9; every day of month; every month; on Mon.
Change it in the cron expression generatorHow the five fields read
| Field | Value | Reads as |
|---|---|---|
| Minute | 0 | at 0 |
| Hour | 9 | at 9 |
| Day of month | * | every value |
| Month | * | every value |
| Day of week | 1 | at Monday |
The next five runs
What people use it for
- A weekly report sent to a team or a client
- Opening a batch of dependency-update pull requests
- A weekly digest or newsletter send
Monday is not always day 1
In standard cron Sunday is 0 and Monday is 1. In AWS EventBridge and Quartz the days are numbered from Sunday = 1, so Monday is 2. A job copied between systems on the number alone fires a day late. Write the day as MON in EventBridge and Quartz, which cannot be misread.
Variations of every Monday
| Expression | What it does |
|---|---|
0 0 * * 1 | Every Monday at midnight. |
0 9 * * 1,4 | Monday and Thursday at 09:00. |
0 9 * * mon | Every Monday at 09:00, written with the day name. |
The same schedule in four tools
Linux crontab
0 9 * * 1 /path/to/commandAdd it with crontab -e. It runs in the machine's time zone.
Kubernetes CronJob
spec:
schedule: "0 9 * * 1"
timeZone: "Etc/UTC"
concurrencyPolicy: ForbidtimeZone 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 9 * * 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 9 ? * MON *)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 every Monday
- How do I run on the first Monday of the month?
- Cron's rule for the two day fields gets in the way: 0 9 1-7 * 1 would run on days 1 to 7 and also on every Monday. Schedule 0 9 * * 1 and make the command check the date, for example [ "$(date +\%d)" -le 7 ] && /path/to/command. The percent sign must be escaped in a crontab.
- Which day does the week start on?
- Cron has no week start. It numbers days 0 to 6 from Sunday, so Monday is 1.
Nearby schedules
- Cron expression for weekdays at 9 AM: Five days a week at the same time.
- Cron expression for every Sunday at 2 AM: Once a week, early on Sunday.
- All schedules and the generator
Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.