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
How it works

Next 5 Runs

  • in 1d 12h
  • in 1d 13h
  • in 1d 13h
  • in 1d 14h
  • in 1d 14h

* Tools

Code & Implementations

Bash
#!/bin/bash
# Safe script to install the cron job for the current user
CRON_EXPR="*/30 9-17 * * 1-5"
JOB_CMD="/usr/local/bin/sync_crm_data.sh >> /var/log/crm_sync.log 2>&1"
# Ensure we do not duplicate the entry in the crontab
(crontab -l 2>/dev/null | grep -F "$JOB_CMD") && echo "Cron job already installed" && exit 0
(crontab -l 2>/dev/null; echo "$CRON_EXPR $JOB_CMD") | crontab -
echo "Cron job successfully installed: $CRON_EXPR"
Setup notes

Save the script to your server, make it executable using chmod +x, and execute it as the user who should run the cron job.

Last verified:

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

Last verified:

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

Last verified:

Was this helpful?