Cron Expression: Every 5 Minutes Between 9 AM and 5 PM (*/5 9-17 * * *)
Need to generate a cron expression?
Use CronOS to generate any cron expression you wish with natural language. Simply describe what you need, and we'll create the perfect cron expression for you. It's completely free!
Cron Expression: Every 5 Minutes Between 9 AM and 5 PM (*/5 9-17 * * *)
The cron expression */5 9-17 * * * executes a task every 5 minutes during business hours (9 AM to 5 PM), making it ideal for frequent monitoring, queue processing, and tasks that need regular execution during work hours.
Expression Breakdown
*/5 9-17 * * *
│ │ │ │ │
│ │ │ │ └─── Day of week: * (every day)
│ │ │ └───── Month: * (every month)
│ │ └─────── Day of month: * (every day)
│ └─────────── Hour: 9-17 (9 AM to 5 PM)
└─────────────── Minute: */5 (every 5 minutes)
Field Values
| Field | Value | Meaning |
|---|---|---|
| Minute | */5 | Every 5 minutes (0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55) |
| Hour | 9-17 | Hours 9 through 17 (9 AM to 5 PM) |
| Day of Month | * | Every day (1-31) |
| Month | * | Every month (1-12) |
| Day of Week | * | Every day of week (0-7) |
Combined Syntax
- Step value (
*/5): Every 5th minute - Range (
9-17): Hours 9 through 17 - Combined: Every 5 minutes during 9 AM to 5 PM
Execution Time
This expression runs 108 times per day (9 hours × 12 executions per hour) at:
- Every 5 minutes from 09:00 to 17:55
Common Use Cases
1. Frequent Business Monitoring
*/5 9-17 * * * /usr/local/bin/business-monitor.sh
Monitor system health, application status, or services frequently during business hours.
2. Queue Processing
*/5 9-17 * * * /usr/bin/node /app/process-queue.js
Process job queues or message queues regularly during work hours.
3. Data Synchronization
*/5 9-17 * * * /usr/bin/python3 /scripts/sync-data.py
Sync data from external systems or APIs frequently during business hours.
4. Cache Refresh
*/5 9-17 * * * /usr/bin/python3 /scripts/refresh-cache.py
Refresh cached data or computed values regularly during work hours.
Example Implementations
Business Monitor Script
#!/bin/bash
# /usr/local/bin/business-monitor.sh
LOG_FILE="/var/log/business-monitor.log"
THRESHOLD_CPU=80
THRESHOLD_MEM=85
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1)
MEM_USAGE=$(free | grep Mem | awk '{printf "%.0f", $3/$2 * 100}')
if (( $(echo "$CPU_USAGE > $THRESHOLD_CPU" | bc -l) )); then
echo "$(date): WARNING - CPU usage at ${CPU_USAGE}%" >> $LOG_FILE
fi
if [ $MEM_USAGE -gt $THRESHOLD_MEM ]; then
echo "$(date): WARNING - Memory usage at ${MEM_USAGE}%" >> $LOG_FILE
fi
Best Practices
- Business Hours: Focuses execution during work hours only
- Execution Time: Tasks should complete within 4-5 minutes
- Error Handling: Implement comprehensive error handling and logging
- Idempotency: Ensure tasks can run multiple times safely
- Resource Management: Monitor CPU, memory, and I/O usage
When to Use
✅ Good for:
- Frequent monitoring during business hours
- Queue processing
- Data synchronization
- Cache refresh
- Regular business-hour checks
❌ Avoid for:
- Real-time critical operations (use every minute)
- Very long-running processes
- Tasks outside business hours
Related Patterns
| Pattern | Expression | Description |
|---|---|---|
| Every 5 min 9-5 | */5 9-17 * * * | Business hours, every 5 minutes |
| Every hour 9-5 | 0 9-17 * * * | Business hours, every hour |
| Every minute 9-5 | * 9-17 * * * | Business hours, every minute |
Conclusion
The */5 9-17 * * * expression is perfect for frequent operations during business hours. It provides regular execution every 5 minutes during work hours while avoiding unnecessary execution outside business time, making it ideal for monitoring, queue processing, and data synchronization during peak usage periods.
Need to generate a cron expression?
Use CronOS to generate any cron expression you wish with natural language. Simply describe what you need, and we'll create the perfect cron expression for you. It's completely free!