【问题标题】:Cron job every day from 8AM to 8PM at 20 minutes interval每天早上 8 点到晚上 8 点的 Cron 作业,间隔 20 分钟
【发布时间】:2014-09-29 06:39:28
【问题描述】:

如何以 20 分钟的间隔每天从 8:00 AM8:00 PM 运行 cron job 例如 cron 作业应该每天从 8:00 AM 开始,然后在 8:20 AM 运行,然后在 8:40 AM 然后 9:00 AM up到8:00 PM。谢谢。

编辑:如何用 ruby​​ whenever gem 实现它。

【问题讨论】:

    标签: ruby cron whenever cron-task whenever-capistrano


    【解决方案1】:

    只需使用两个 cronjobs:

    */20 8-19 * * * /your/script
    0 20 * * * /your/script
    

    即:

    • 每 20 分钟运行一次,从 8 小时到 19 小时
    • 一个在 20:00 运行。

    提醒一下,这是 cronjob 的格式:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-12
      • 2022-10-13
      相关资源
      最近更新 更多