How do you run a cron job on the first of every month?
By TechCompare · Updated · How we check
0 0 1 * * is correct for first-of-month execution. For last-day-of-month scheduling, use a wrapper script or switch to systemd timers. If you need the 15th, 20th, or any day that exists in every month, the standard day-of-month field works without caveats.
Calculator
Next runs of 0 0 1 * *
Example from Mon, Nov 9, 2026 at 8:00 AM.
- Tue, Dec 1, 2026 at 12:00 AM
- Fri, Jan 1, 2027 at 12:00 AM
- Mon, Feb 1, 2027 at 12:00 AM
- Mon, Mar 1, 2027 at 12:00 AM
- Thu, Apr 1, 2027 at 12:00 AM
0 0 1 * * runs a job at midnight on the first day of every month. The third field (1-31) controls the day of the month.
How this is calculated
Not every month has 31 days. If you specify the 31st, the job simply won't run in February, April, June, September, or November.
For the last day of the month, cron alone can't express it. The common workaround is to run on the 28th-31st and have the script check if tomorrow is the 1st. Alternatively, use 0 0 28-31 * * and let the script exit early if the date isn't the last day.
On systemd versions that support the last-day token, OnCalendar=*-*~01 00:00:00 can express the last day directly.
Verdict
Use 0 0 1 * * for the first of the month, and avoid the 31st, which silently skips February, April, June, September, and November. For last-day runs, standard cron needs 28-31 plus a script guard that checks if tomorrow is the 1st.
More Cron scenarios
Related guides
Frequently asked questions
How do I run a cron job on the first of every month?
What happens if I schedule a cron job for the 31st of the month?
How do I run a cron job on the last day of the month?
Related tools
Unix Timestamp
Convert between Unix timestamps and human-readable dates.
Use toolCHMOD Configurator
Calculate Linux file permissions using checkboxes or octal numbers, then view the matching symbolic notation.
Use toolText Encoding Converter
Convert text to Base64, binary, hex, URL encoding and HTML entities, and back again.
Use tool