T
ToolPrime

Cron Expression for Hourly During Business Hours

Run a cron job every hour from 9 AM to 5 PM on weekdays using 0 9-17 * * 1-5. Combines hourly frequency with business-day restrictions.

Expression

0 9-17 * * 1-5

Every hour from 09:00 to 17:00, Monday through Friday

Use Cases

Code Examples

Crontab

# Every hour from 09:00 to 17:00, Monday through Friday
0 9-17 * * 1-5 /path/to/your/script.sh

GitHub Actions

name: Scheduled Job
on:
  schedule:
    - cron: '0 9-17 * * 1-5'
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Running Hourly During Business Hours"

systemd Timer

[Unit]
Description=Hourly During Business Hours timer

[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true

[Install]
WantedBy=timers.target

Tips

Frequently Asked Questions

How do I run hourly only during work hours?

Use 0 9-17 * * 1-5 to run at the top of each hour from 9 AM through 5 PM, Monday to Friday.

Does the range 9-17 include 5 PM?

Yes, cron ranges are inclusive. 9-17 covers hours 9, 10, 11, 12, 13, 14, 15, 16, and 17.

Related Cron Expressions