Run a cron job every minute only on specific hours?

后端 未结 2 2055
时光取名叫无心
时光取名叫无心 2020-12-31 01:00

How do you run a cron job every minute only on specific hours? Like so:

It will only check every minute from 11AM to 12AM, 4PM to 5PM and 9PM to 10PM<

2条回答
  •  借酒劲吻你
    2020-12-31 01:38

    As per the cron format

         
    
    * * * * * *
    | | | | | | 
    | | | | | +-- Year              (range: 1900-3000)
    | | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
    | | | +------ Month of the Year (range: 1-12)
    | | +-------- Day of the Month  (range: 1-31)
    | +---------- Hour              (range: 0-23)
    +------------ Minute            (range: 0-59)
    

    the solution should be

    * 11,16,21 * * * *
    

提交回复
热议问题