Will crontab hour range a-b run after b too?

后端 未结 3 1721
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 01:06

Say I have a crontab which runs every 20 minutes and I have a hour range which can vary so lets say a-b, which in one example could look like

3条回答
  •  轮回少年
    2021-01-18 01:38

    GK27's answer does not fully answer the question, so let me clarify:

    cron will run jobs when the time matches the expression provided. Your expression tells it to run when the minute is divisible by 20 (*/20) and your hour range tells it to run when the hour is within the specified range inclusively (5-23). The remaining three * tell it to match any day, month, and any day of the week.

    Therefore the first job will run at 05:00 because the hour, 05, is in the range 5 to 23 and the minute, 00, is divisible by 20. The last job will run at 23:40 because the hour, 23, is in the range 5 to 23 and the minute, 40, is divisible by 20. It will not run at 00:00 because the hour, 00, is not in the range 5 to 23.

提交回复
热议问题