Quarterly Midnight Cleanups and Reports | CronBase

cron expression Standard
$ 0 0 1 */3 *

At midnight on the first day of every third month, starting in January.

This cron expression executes a task at midnight on the first day of every third month, initiating a quarterly schedule. It triggers at twelve AM on January first, April first, July first, and October first, providing a predictable cadence for financial reporting, automated data archiving, and long-term log rotation.

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

Next 5 Runs

  • in 67d 3h
  • in 159d 3h
  • in 249d 3h
  • in 340d 3h
  • in 432d 3h

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
set -euo pipefail
# Register this script in your system crontab using:
# 0 0 1 */3 * /usr/local/bin/quarterly_cleanup.sh >> /var/log/cron_quarterly.log 2>&1

LOG_FILE="/var/log/cron_quarterly.log"
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] Starting quarterly maintenance task..." | tee -a "$LOG_FILE"

# Perform cleanup or reporting
if ! /usr/local/bin/perform_quarterly_audit.sh; then
    echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] ERROR: Quarterly audit failed!" >&2
    exit 1
fi

echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] Quarterly maintenance completed successfully." | tee -a "$LOG_FILE"
Setup notes

Place this script in /usr/local/bin/quarterly_cleanup.sh, make it executable with chmod +x, and add the corresponding cron entry using crontab -e.

Last verified:

Partner BetterStack

Monitor this schedule in production

Get alerted the moment this cron job fails, is late, or doesn't run. BetterStack tracks execution, duration, and output — no infrastructure required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(0 0 1 */3 ? *)

Systemd Timer

OnCalendar*-00/3-01 00:00:00

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

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

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

Which months exactly does this quarterly cron schedule run?

This cron schedule runs on the first day of January, April, July, and October. These months correspond to the standard calendar quarters (Q1, Q2, Q3, and Q4).

What happens if my server is offline at midnight on the first day of the quarter?

Standard Linux cron will miss the execution entirely. For critical business tasks, you should use an orchestrator like Kubernetes CronJobs, Airflow, or a tool like anacron that catches up on missed runs.

How do I test this quarterly cron expression without waiting three months?

You can temporarily modify the expression to run in the next few minutes (e.g., '*/5 * * * *') in your staging environment to verify the script logic, or trigger the job manually via systemctl or kubectl.

Can I offset this to run at 2 AM instead of midnight to avoid peak traffic?

Yes, you can shift the time by changing the hour field. Modify the expression to '0 2 1 */3 *' to run at 2:00 AM on the first of the month, reducing resource contention.

Does standard cron support timezone-aware quarterly scheduling?

No, standard system cron uses the local timezone of the host operating system. To run based on a specific timezone, you must configure the server's timezone or use an application-level scheduler.

* Explore

Related expressions you might need

Last verified:

Was this helpful?