dav
dav

Reputation: 9267

Run cron job every minute during specific hour during 30 minutes

I know I can set up cron for every minute, like

* * * * *

for once a day AFAIK it would be (lets say on 2am)

0 2 * * * 

for every 30 minutes

0,30 * * * * 

Now, is it possible to run cron job every minute, but during 30 minutes, once a day. For example I need the cron to run every day from 2am to 2:30, and during that time every minute.

thanks

Upvotes: 2

Views: 3229

Answers (1)

fedorqui
fedorqui

Reputation: 289725

Yes, sure. Use this:

0-30 2 * * *
^^^^ ^
 |   |
 |   on hour 2
on minutes from 0 to 30

Remember the format is as follows:

 +---------------- minute (0 - 59)
 |  +------------- hour (0 - 23)
 |  |  +---------- day of month (1 - 31)
 |  |  |  +------- month (1 - 12)
 |  |  |  |  +---- day of week (0 - 6) (Sunday=0 or 7)
 |  |  |  |  |
 *  *  *  *  *  command to be executed

Upvotes: 3

Related Questions