Run Monthly Jobs at 4 AM on Day 1 | CronBase

cron expression Standard
$ 0 4 1 * *

At four o'clock in the morning on the first day of every month

The `0 4 1 * *` cron expression schedules a task to run automatically at 4:00 AM on the first day of every calendar month. This highly predictable monthly interval is ideally suited for executing heavy database cleanups, generating recurring customer invoices, and compiling monthly analytical reports without impacting peak business hours.

Minute
0
Hour
4
Day of Month
1
Month
*
Day of Week
*
How it works

Next 5 Runs

  • in 6d 7h
  • in 37d 7h
  • in 67d 7h
  • in 98d 7h
  • in 128d 7h

* Tools

Code & Implementations

Bash
# Standard crontab entry to run a monthly cleanup script at 4:00 AM
# Ensure the output is redirected to a log file for auditing
0 4 1 * * /usr/local/bin/monthly_cleanup.sh >> /var/log/cron_monthly.log 2>&1
Setup notes

Add this line to your user crontab using the 'crontab -e' command. Make sure the target script is executable.

Last verified:

Partner UptimeRobot

Keep this cron job monitored 24/7

UptimeRobot alerts you the moment a scheduled job stops responding. Free plan monitors up to 50 endpoints — no credit card required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(0 4 1 * ? *)

Systemd Timer

OnCalendar*-*-01 04:00:00

my-task.timer
[Unit]
Description=Timer for cron expression: 0 4 1 * *

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

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

How does daylight saving time affect this 4:00 AM schedule?

If your system timezone is configured to a local zone that observes DST, the job might run twice or be skipped during transition periods. Operating your server's system clock or cron runner in UTC completely mitigates this issue.

What happens if the server is offline at 4:00 AM on the first of the month?

Standard cron does not catch up on missed executions. If your server is down, the job will not run until the next month. For critical tasks, use tools like Anacron or cloud schedulers with retry policies.

Is 4:00 AM a safe time to run heavy database migrations?

Yes, 4:00 AM is typically a low-traffic window. However, since it is the first of the month, ensure it does not conflict with automated billing runs or third-party API processing which also favor this date.

How can I test this monthly cron expression without waiting a month?

You can temporarily modify the cron expression to run every few minutes (e.g., `*/5 * * * *`) in a staging environment to verify the script logic, or trigger the underlying execution script manually.

How should I handle failures for a job that only runs monthly?

Implement immediate alerting via Slack or PagerDuty on failure. Because the job only triggers once a month, you must ensure your script is idempotent so that you can safely trigger it manually after fixing any issues.

* Explore

Related expressions you might need

Last verified:

Was this helpful?