Run Daily Maintenance at 1:30 AM | CronBase

cron expression Standard
$ 30 1 * * *

At half past one in the morning every single day

This cron expression schedules a task to execute automatically every day at exactly 1:30 AM. It is widely used in production environments for off-peak operations such as database backups, log rotation, clearing temporary caches, and synchronizing daily analytical data when user activity and system load are at their lowest.

Minute
30
Hour
1
Day of Month
*
Month
*
Day of Week
*
How it works

Next 5 Runs

  • in 4h 53m
  • in 1d 4h
  • in 2d 4h
  • in 3d 4h
  • in 4d 4h

* Tools

Code & Implementations

Bash
#!/bin/bash
# System crontab entry for daily maintenance at 1:30 AM
# Uses flock to prevent overlapping runs and redirects output to a logfile with timestamps

# Installation: Add this to your crontab using 'crontab -e':
# 30 1 * * * /usr/local/bin/daily-cleanup.sh >> /var/log/daily-cleanup.log 2>&1

LOCKFILE="/var/run/daily-cleanup.lock"
exec 9>"$LOCKFILE"
if ! flock -n 9; then
    echo "[$(date -u)] Script is already running. Exiting to prevent overlap." >&2
    exit 1
fi

echo "[$(date -u)] Starting daily maintenance task..."
# Perform maintenance tasks (e.g., clearing tmp, rotating files)
# Add your production logic here...

exit 0
Setup notes

Add the script to your server, make it executable with chmod +x, and register the job using 'crontab -e' with the schedule '30 1 * * *'.

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(30 1 * * ? *)

Systemd Timer

OnCalendar*-*-* 01:30:00

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

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

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

How does Daylight Saving Time affect the 1:30 AM execution?

During DST transitions, the 1:30 AM slot can be tricky. When clocks spring forward, 1:30 AM is skipped in some local timezones, meaning your job might not run. When clocks fall back, it might execute twice. To avoid this, always run your system cron daemons in UTC.

Why should I schedule backups at 1:30 AM instead of midnight?

Midnight is the default target for many automated tasks, leading to severe resource contention, high CPU spikes, and network bottlenecks. Shifting your resource-heavy tasks to 1:30 AM isolates your workload from standard midnight rollups and ensures smoother execution.

How do I prevent a slow-running 1:30 AM job from overlapping?

Use a locking utility like `flock` in Linux or implement a distributed lock manager (like Redis-based Redlock) in your application. This ensures that if the previous day's execution is still running for over 24 hours, the new instance will safely abort.

Can I run this job only on weekdays using standard cron?

Yes, you can easily restrict this schedule to weekdays by changing the last field. Modifying the expression to `30 1 * * 1-5` will execute your task at 1:30 AM from Monday through Friday, skipping the weekend entirely.

How should I monitor if the 1:30 AM job failed to run?

Implement dead man's snitches or health checks. Have your job ping an external monitoring service (like Cronitor or Sentry) upon successful completion. If the service doesn't receive the ping by 1:45 AM, it triggers an alert for your on-call engineering team.

* Explore

Related expressions you might need

Last verified:

Was this helpful?