Cron: Every 2 Hours, Monday to Friday
To run a cron job every two hours on weekdays only, use 0 */2 * * 1-5. The step */2 in the hour field fires at 0, 2, 4 … 22, minute 0 pins each to the top of the hour, and 1-5 limits it to Monday-Friday.
The expression
0 */2 * * 1-5 runs every 2 hours on weekdays. Copy it straight into your crontab with crontab -e.
Every other hour, skipping weekends
0 */2 * * 1-5 runs at 00:00, 02:00, 04:00 … 22:00 on weekdays. To keep it inside office hours instead, use a range step: 0 9-17/2 * * 1-5 for 09:00, 11:00, 13:00, 15:00, 17:00.
Why 1-5 means Monday to Friday
The fifth field is day-of-week: 0 (or 7) is Sunday, 1 is Monday, up to 6 Saturday. The range 1-5 is Monday through Friday, so the job skips weekends automatically.
FAQ
What is the cron expression to run every 2 hours on weekdays?
0 */2 * * 1-5 — read it field by field: minute, hour, day-of-month, month, day-of-week.
How do I limit a cron job to Monday-Friday?
Set the fifth field (day-of-week) to 1-5. 0 and 7 are Sunday, 6 is Saturday, so 1-5 is Monday through Friday and weekends are skipped.
Does cron count hours in 24-hour time?
Yes. The hour field is 0-23, where 0 is midnight, 12 is noon and 17 is 5 PM. There is no AM/PM in cron.