Run Nightly Weekday Jobs at 10 PM | CronBase

cron expression Standard
$ 0 22 * * 1-5

Every night from Monday through Friday at ten o'clock in the evening.

The `0 22 * * 1-5` cron expression schedules a task to run automatically every weekday night, from Monday through Friday, precisely at 10:00 PM. It is commonly used in enterprise environments to trigger end-of-day database backups, synchronize transactional data, and clean up temporary storage volumes after business hours.

Minute
0
Hour
22
Day of Month
*
Month
*
Day of Week
1-5

Next 5 Runs

  • in 12h 0m
  • in 3d 12h
  • in 4d 12h
  • in 5d 12h
  • in 6d 12h

* Tools

Code & Implementations

nodejs
const cron = require('node-cron');
const { exec } = require('child_process');

console.log('Initializing scheduler dynamic worker...');

// Schedule the weekday task at 10:00 PM (22:00)
const scheduledTask = cron.schedule('0 22 * * 1-5', () => {
  const timestamp = new Date().toISOString();
  console.log(`[${timestamp}] Starting scheduled weekday night processing...`);
  
  exec('/usr/local/bin/process-batch.sh', (error, stdout, stderr) => {
    if (error) {
      console.error(`[${timestamp}] Execution failed:`, error.message);
      return;
    }
    if (stderr) {
      console.warn(`[${timestamp}] Standard Error Output:`, stderr);
    }
    console.log(`[${timestamp}] Execution output:`, stdout);
  });
}, {
  scheduled: true,
  timezone: "America/New_York"
});

scheduledTask.start();
Setup notes

Install the node-cron package using npm install node-cron, save this script to scheduler.js, and execute it continuously using a process manager like PM2.

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 22 ? * 1-5 *)

Systemd Timer

OnCalendarMon..Fri *-*-* 22:00:00

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

[Timer]
OnCalendar=Mon..Fri *-*-* 22:00:00
Persistent=true

[Install]
WantedBy=timers.target

Frequently Asked Questions

How does Daylight Saving Time affect a 10 PM weekday cron job?

If your host OS or execution environment is set to local time (e.g., Eastern Time), the job will shift along with Daylight Saving Time transitions. This means it will always execute at 10:00 PM local time. If your system is set to UTC, the execution time relative to your local time will shift forward or backward by one hour twice a year. To prevent this, configure your scheduler or runner to target a specific timezone instead of falling back to UTC.

Can I use this expression to run jobs on weekends too?

No, this specific expression (`1-5` in the fifth field) restricts execution strictly to Monday through Friday. If you want to include weekends, you must change the fifth field to `0-6` (or `*`), which would schedule the task to run every single night of the week at 10:00 PM.

What happens if a weekday holiday falls on one of these run times?

Standard cron engines do not possess holiday awareness; they will execute the scheduled task on holidays if they fall on a weekday. To prevent executions on corporate holidays, you must write program logic inside your application or wrapper script to check a holiday calendar API or database and gracefully exit early.

How can I prevent overlapping runs if a Friday job takes over 24 hours?

To prevent concurrent execution overlaps, you must implement a locking mechanism. In Kubernetes, you can set `concurrencyPolicy: Forbid`. In custom environments, use file locks via `flock` or distributed locks via Redis or Consul to ensure that if a previous night's job is still active, the new run terminates immediately.

Why is my task running at 5 PM instead of 10 PM?

This is almost always a timezone mismatch. Your system or application daemon is likely running on UTC time, which makes 10:00 PM UTC correspond to 5:00 PM EST or 6:00 PM EDT. To fix this, change the server's system timezone to your local timezone, or use a scheduling library (like APScheduler or Spring) that explicitly supports timezone overrides.

* Explore

Related expressions you might need

Was this helpful?

Last verified: