Run Jobs at Start, Midday, and End of Weekdays | CronBase

cron expression Standard
$ 0 8,12,17 * * 1-5

Every Monday through Friday at morning, noon, and late afternoon.

This cron expression executes a task three times daily at 8:00 AM, 12:00 PM, and 5:00 PM, exclusively on weekdays (Monday through Friday). It is ideal for orchestrating business-day workflows, such as syncing transactional ledgers, sending daily status digests, or initiating system health checks during standard corporate operating hours.

Minute
0
Hour
8,12,17
Day of Month
*
Month
*
Day of Week
1-5

Next 5 Runs

  • in 1h 59m
  • in 6h 59m
  • in 2d 21h
  • in 3d 1h
  • in 3d 6h

* Tools

Code & Implementations

nodejs
// Ensure you have run: npm install node-cron
const cron = require('node-cron');
const { exec } = require('child_process');

// Schedule: 0 8,12,17 * * 1-5 (Monday to Friday at 8am, 12pm, 5pm)
const scheduleExpression = '0 8,12,17 * * 1-5';

const task = cron.schedule(scheduleExpression, () => {
    console.log(`[${new Date().toISOString()}] Initiating scheduled database synchronization...`);
    
    exec('/opt/scripts/sync_db.sh', (error, stdout, stderr) => {
        if (error) {
            console.error(`[ERROR] Task execution failed: ${error.message}`);
            return;
        }
        if (stderr) {
            console.warn(`[WARN] Task stderr: ${stderr}`);
        }
        console.log(`[SUCCESS] Task output: ${stdout.trim()}`);
    });
}, {
    scheduled: true,
    timezone: "America/New_York"
});

task.start();
Setup notes

Install the required package using npm install node-cron. Save the script as scheduler.js and run it in a background process runner like PM2 (pm2 start scheduler.js) to ensure continuous execution.

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 8,12,17 ? * 1-5 *)

Systemd Timer

OnCalendarMon..Fri *-*-* 08,12,17:00:00

my-task.timer
[Unit]
Description=Timer for cron expression: 0 8,12,17 * * 1-5

[Timer]
OnCalendar=Mon..Fri *-*-* 08,12,17:00:00
Persistent=true

[Install]
WantedBy=timers.target

Frequently Asked Questions

How does Daylight Saving Time affect this weekday schedule?

Since this schedule runs at specific local business hours (8, 12, 17), running your system on UTC will cause the local execution time to shift twice a year. To prevent this, configure your scheduler or cron daemon to respect a specific local timezone, or use a timezone-aware scheduler wrapper.

What happens if a job runs longer than 4 hours and overlaps?

If your midday execution (12:00 PM) takes longer than 5 hours, it will overlap with the 5:00 PM run. Use concurrency locking (e.g., flock in Bash, Redlock in Redis, or `concurrencyPolicy: Forbid` in Kubernetes) to prevent simultaneous instances from corrupting data.

Can I configure this to exclude specific corporate holidays?

Standard cron cannot parse holidays natively. To achieve this, execute the job on the schedule, but implement an initial guard clause in your application code that checks a holiday API or database table and exits early if the current date is a holiday.

Is it possible to shift the 5:00 PM run to 5:30 PM using standard cron?

No, standard cron applies the minute field (0) to all specified hours (8, 12, 17). To run at 8:00 AM, 12:00 PM, and 5:30 PM, you must define two separate cron entries: `0 8,12 * * 1-5` and `30 17 * * 1-5`.

How can I monitor failures specifically for these three daily runs?

Integrate a monitoring heartbeat tool (like Healthchecks.io or Opsgenie) with a grace period of 10 minutes. Configure your script to ping the check-in URL upon successful completion, alerting your on-call team if a run is missed.

* Explore

Related expressions you might need

Was this helpful?

Last verified: