How can I run a cron job every 5 minutes starting from a time other than 0 minutes?

前端 未结 4 496
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 15:37

I would like to have a script run every 5 minutes let\'s say starting from 13:02 so I can have another script runs every 5 minutes but starting from 13:04 so the second scri

4条回答
  •  情歌与酒
    2020-12-07 16:02

    Use this:

    */5+2 * * * * 1st-script
    */5+4 * * * * 2nd-script
    

    For future reference take a look at this online Cron Job Generator.

    Update

    Since there are several reports that the + syntax is not working on Ubuntu 14.04, here's a variation:

    2-59/5 * * * * 1st-script
    4-59/5 * * * * 2nd-script
    

    This will result in the 1st script to run every 5 minutes starting with an offset of 2 minutes at the beginning of each hour and the 2nd script to behave the same with an offset of 4 minutes.

提交回复
热议问题