Cron expression for every month
0 0 1 * * runs a job at midnight on the first day of every month. The shortcut is @monthly.
Runs entirely in your browser. Nothing you paste is sent to our server, stored or logged.
0 0 1 * *
When it runs next
What it means
The third field, the day of the month, is fixed at 1 and the month is an asterisk, so the job runs twelve times a year. It is the usual schedule for invoices, monthly reports and rotating logs or credentials.
Running on the last day of the month is harder, because months end on different days and standard cron has no symbol for it. The usual approach is to run on days 28 to 31 and let the script check whether tomorrow is the first of the month before it does any work.
Common variations
| Expression | Runs |
|---|---|
0 9 1 * * | At 9:00 on the first of every month |
0 0 15 * * | At midnight on the 15th of every month |
0 0 1 */3 * | On the first day of every quarter |
As a crontab line
Add the command you want to run after the five fields, then save it with
crontab -e:
0 0 1 * * /path/to/script.sh