Take the 2-minute tour ×

I am trying to setup a cron job on a Ubuntu server. We want the cron job to run the script at certain times of the day and on some specific days of the week. For example, we want to setup a cron job that runs the script with the following sequence

Execute the script every 2 mins from 9 am to 2 pm during the weekdays.

This is what I have been able to do so far:

*/2 09-18 * * * /path_to_script

What should I do for the weekdays?

share|improve this question

2 Answers 2

up vote 33 down vote accepted

Same as you did for hours:

*/2 09-18 * * 1-5 /path_to_script

0 and 7 stand for Sunday
6 stands for Saturday
so, 1-5 means from Monday to Friday

share|improve this answer
that worked, thanks –  Nauman Bashir Jan 21 '13 at 14:01

You state 2pm in your requirement, hour range should end at 14 instead of 18 (which is 6pm).

*/2 9-14 * * 1-5 /path_to_script

man crontab


share|improve this answer
heh +1 for pointing that out, but the time in the example was in general context :) –  Nauman Bashir Jan 23 at 11:35

Your Answer


