← Zurück zu Anleitungen
How to Run a Cron Job Every 5 Minutes (with Examples)
· Tags: cron-every-5-minutes, every-5-minutes-cron, cron-interval, crontab-examples, scheduling
How to Run a Cron Job Every 5 Minutes
The "every 5 minutes" cron expression is one of the most common scheduling patterns for health checks, monitoring scripts, and background queue processing. This guide shows you exactly how to write it and where to use it.
The Every 5 Minutes Cron Expression
To run a command every 5 minutes, use the */5 operator in the minute field:
*/5 * * * * /path/to/script.sh
This expression runs /path/to/script.sh at minute 0, 5, 10, 15, 20, and so on — 288 times per day.
Common Variations
Every 5 minutes during working hours
*/5 9-17 * * 1-5 /path/to/script.sh
Runs every 5 minutes between 9:00 and 17:59, Monday through Friday.
Every 10 or 15 minutes
Simply change the divisor:
*/10 * * * * /path/to/job.sh # every 10 minutes
*/15 * * * * /path/to/job.sh # every 15 minutes
Use Cases
- Health checks: Verify an API or service is responding every 5 minutes
- Queue processing: Drain a message queue on a fixed interval
- Monitoring: Collect metrics or log tail samples at regular intervals
Summary
Remember: */5 in the minute field is the canonical way to schedule a job every 5 minutes in cron. Pair it with hour, day, month, and weekday fields to narrow the window.