Jesus_Maria Jesus_Maria - 6 months ago 26
Linux Question

Cronjob understanding: how to run every day from 8-10 till 10-30 every 10 and 30 minute?

I need to run task every day from 8-10 till 10-30 every 10 and 30 minute:

start at 8:10 ->
8:30 ->
9:10 ->
..
-> 10:30 finish


I have such cronjob:

10,30 8,9,10 * * *


will it be correct?

Answer

Yes, it is fine!

You can check it in http://crontab.guru/#10,30_8,9,10_*_*_*

Since you want to run it in an interval of hours, you can also say 8-10 to match hours from 8 to 10:

10,30 8-10 * * *

For your future reference, this is the format for cronjobs:

 +---------------- 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 
Comments