Run Every 30 Minutes During Business Hours | CronBase

cron expression Standard
$ */30 9-17 * * 1-5

Every half hour during standard business hours on weekdays, starting at nine in the morning and ending at five in the afternoon.

This cron expression schedules a task to execute every thirty minutes, specifically at the top of the hour and thirty minutes past the hour, between the hours of 9:00 AM and 5:30 PM, Monday through Friday. It is ideal for business-day automated processing.

Minute
*/30
Hour
9-17
Day of Month
*
Month
*
Day of Week
1-5

Next 5 Runs

  • in 29m 29s
  • in 59m 29s
  • in 1h 29m
  • in 1h 59m
  • in 2h 29m

* Tools

Code & Implementations

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

// Schedule task to run every 30 minutes during business hours (9 AM - 5 PM, Mon-Fri)
const task = cron.schedule('*/30 9-17 * * 1-5', () => {
  console.log(`[${new Date().toISOString()}] Starting business hour sync...`);
  exec('/usr/local/bin/sync-job.sh', (error, stdout, stderr) => {
    if (error) {
      console.error(`Execution error: ${error.message}`);
      return;
    }
    if (stderr) console.warn(`Stderr: ${stderr}`);
    console.log(`Stdout: ${stdout}`);
  });
}, {
  scheduled: true,
  timezone: "America/New_York" // Explicitly define timezone to handle DST shifts
});
task.start();
Setup notes

Install the dependency using npm install node-cron and run the script using node scheduler.js in 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(*/30 9-17 ? * 1-5 *)

Systemd Timer

OnCalendarMon..Fri *-*-* 09..17:00/30:00

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

[Timer]
OnCalendar=Mon..Fri *-*-* 09..17:00/30:00
Persistent=true

[Install]
WantedBy=timers.target

Frequently Asked Questions

Does this schedule execute exactly at 5:00 PM or does it run until 5:30 PM?

It runs at both 5:00 PM and 5:30 PM. The hour range '9-17' is inclusive of the 17th hour (5 PM), meaning executions occur at 17:00 and 17:30. The next scheduled run after 17:30 will be at 09:00 the following weekday morning.

How do Daylight Saving Time (DST) changes affect this weekday business schedule?

Standard system cron utilities typically run on system time (which is often set to UTC). If your system is set to UTC, the schedule will not shift for DST, causing your business-hour jobs to run an hour early or late relative to local business time. To prevent this, use a timezone-aware scheduler wrapper or set your host timezone to your local region.

What happens if a job execution takes longer than 30 minutes to complete?

With standard cron, a new process will start at the next 30-minute mark regardless of whether the previous instance finished. This can cause overlap, database locking issues, and resource exhaustion. To prevent this, implement locking using tools like flock in Bash, or use the Kubernetes 'concurrencyPolicy: Forbid' option.

Is it possible to exclude national holidays from this weekday business cron schedule?

Standard cron dialects do not have built-in holiday awareness. To handle holidays, your execution script or application code must check a holiday calendar API or database table at startup and exit gracefully if the current date is a designated holiday.

How can I test the schedule locally to verify it triggers correctly on weekends?

You can temporarily modify the day-of-week field from '1-5' to '*' or include the current weekend day (e.g., '1-5,6' for Saturday) in a local testing environment. Alternatively, mock your system time or use simulation tools like croniter in Python to verify execution timestamps.

* Explore

Related expressions you might need

Was this helpful?

Last verified: