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
*

Next 5 Runs

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

* Tools

Code & Implementations

nodejs
// cron-job.js
// Requires: npm install node-cron
const cron = require('node-cron');
const { exec } = require('child_process');

console.log('Initializing late-night daily cron scheduler...');

// Schedule task to run daily at 23:00 (11:00 PM)
cron.schedule('0 23 * * *', () => {
    const timestamp = new Date().toISOString();
    console.log(`[${timestamp}] Starting daily database backup transaction...`);

    exec('/usr/local/bin/backup-db.sh', (error, stdout, stderr) => {
        if (error) {
            console.error(`[${timestamp}] Backup failed: ${error.message}`);
            return;
        }
        if (stderr) {
            console.warn(`[${timestamp}] Backup warning: ${stderr}`);
        }
        console.log(`[${timestamp}] Backup completed: ${stdout}`);
    });
}, {
    scheduled: true,
    timezone: "UTC"
});
Setup notes

Install the required package node-cron using npm, then run this file as a background daemon using a process manager like PM2: pm2 start cron-job.js --name daily-cron.

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

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

Was this helpful?

Last verified: