Schedule Daily Late Night Tasks at 11 PM | CronBase

cron expression Standard
$ 0 23 * * *

Every day at eleven o'clock in the evening.

The `0 23 * * *` cron expression schedules a job to run every single day at exactly 11:00 PM (23:00) in the system's local timezone. It is commonly used for executing late-night data synchronization, daily database backups, log rotation preparations, and system maintenance tasks before the date rolls over to the next calendar day.

Minute
0
Hour
23
Day of Month
*
Month
*
Day of Week
*
How it works

Next 5 Runs

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

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
# Production Bash Cron Job Wrapper
# Scheduled via: 0 23 * * * /path/to/script.sh

set -euo pipefail

LOCKFILE="/var/lock/daily_cleanup.lock"
exec 200>"$LOCKFILE"

# Acquire an exclusive lock without blocking
if ! flock -n 200; then
    echo "Error: Another instance of this late-night job is already running." >&2
    exit 1
fi

echo "[$(date -u)] Starting daily maintenance tasks..."
# Real task execution here
# /usr/local/bin/cleanup-database-logs

echo "[$(date -u)] Daily maintenance completed successfully."
Setup notes

Save the script to /usr/local/bin/daily_cleanup.sh, make it executable with chmod +x, and add the entry 0 23 * * * /usr/local/bin/daily_cleanup.sh to your system crontab 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 23 * * ? *)

Systemd Timer

OnCalendar*-*-* 23:00:00

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

[Timer]
OnCalendar=*-*-* 23:00:00
Persistent=true

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

Why should I schedule backups at 23:00 instead of midnight?

Scheduling at 23:00 avoids the massive peak in resource utilization that typically occurs at midnight (00:00) when many automated system scripts, log rotators, and cron jobs default to run. This staggered approach ensures better CPU, memory, and network I/O availability.

How does Daylight Saving Time affect a job scheduled for 23:00?

In almost all timezones, Daylight Saving Time (DST) transitions occur at 01:00, 02:00, or 03:00. Because 23:00 is well outside of these transition windows, your job will execute reliably once per day, though the absolute UTC time of execution will shift by one hour.

What is the best way to handle long-running jobs that start at 23:00?

Ensure your scripts implement file-locking mechanisms (like `flock` in Bash) or database locks to prevent a stalled execution from overlapping with the next day's run. Additionally, set strict execution timeouts and configure monitoring alerts to notify you if the process runs past 3 hours.

How can I stagger this job across multiple servers to prevent API rate limits?

Instead of running exactly at 23:00:00 on all nodes, introduce a sleep interval or randomized jitter at the start of your script (e.g., `sleep $((RANDOM % 300))`). This spreads the network traffic and API requests over a five-minute window.

Can I use standard cron to run this only on weekdays at 23:00?

Yes, you can modify the fifth field of the cron expression. Changing the expression to `0 23 * * 1-5` will restrict the execution to Monday through Friday at 11:00 PM, skipping Saturday and Sunday.

* Explore

Related expressions you might need

Last verified:

Was this helpful?