buildcron

Cron Expression for Every Month

To run a cron job every month, use 0 0 1 * *: it runs once a month, at 00:00 on the 1st. @monthly is shorthand for the same schedule.

CRON → ENGLISH
0 minute0 hour1 day of month* month* day of week
VALID EXPRESSION

At 12:00am on day 1 of the month.

0 0 1 * *

Standard 5-field crontab syntax. Day of month and day of week are OR'd when both are set.

NEXT 5 RUN TIMES · local time

What it does

Monthly schedules use the day of month field. 1 restricts the run to the first day, 0 0 sets the time to midnight, and the month and day of week fields stay as * so every month counts. Leaving the day of week open matters — if it were restricted too, cron would OR the two day fields and run far more often.

Once a month suits billing and bookkeeping: generating invoices, charging subscriptions, emailing statements, archiving a month of logs, resetting monthly usage quotas, or producing reports for the month that just ended. Many of these are really about the previous month, so the job should work out last month's date range rather than “this month”.

Every day from 1 to 28 exists in every month, so 0 6 15 * * (06:00 on the 15th) is always safe. Days 29 to 31 aren't: 0 0 31 * * runs in only seven months of the year, and cron skips the others without any warning. If a job has to run at the end of every month, see the last-day-of-the-month page — standard cron can't express it directly.

How 0 0 1 * * works, field by field

FIELDVALUEMEANING
Minute0minute 0
Hour0hour 0 (midnight)
Day of month1day 1 of the month
Month*every month
Day of week*every day of the week

Put together, cron reads 0 0 1 * * as: “At 12:00am on day 1 of the month.

To see further ahead, paste the expression into the cron calculator, which lists the next ten run times and counts how many times the schedule runs in a year.

Frequently asked questions

What does 0 0 1 * * mean?

Minute 0, hour 0, day of month 1, any month, any day of the week — midnight on the first day of every month, twelve runs a year.

How do I run a cron job every 3 months?

Add a step to the month field: 0 0 1 */3 * runs at midnight on 1 January, 1 April, 1 July and 1 October. Months count from 1, so */3 starts in January.

Why didn't my monthly cron job run in February?

Probably because it's scheduled for day 29, 30 or 31. Cron never moves a run to another day, so a date that doesn't exist in a month is simply skipped. Use a day from 1 to 28 for a job that must run every month.