【问题标题】:What is the syntax for a cron job that runs 15 and 45 minutes after the hour?每小时后 15 分钟和 45 分钟运行的 cron 作业的语法是什么?
【发布时间】:2011-10-25 18:49:21
【问题描述】:

在整点后 15 分钟和 45 分钟运行的 cron 作业的语法是什么? (所以每 30 分钟一次。)

语法是否类似于:

15,45,30   *       *       *       *       wget -O /dev/null http://somesite.com/4_leads.php

所以例如它会运行在

2:15
2:45
3:15
3:45
4:15
4:45

等等

【问题讨论】:

    标签: cron crontab


    【解决方案1】:

    来自man 5 crontab

    field          allowed values
    -----          --------------
    minute         0-59
    hour           0-23
    day of month   1-31
    month          1-12 (or names, see below)
    day of week    0-7 (0 or 7 is Sun, or use names)
    

    或者,换句话说

    # m   h   dom mon dow   user          command
    15,45 *    *   *   *    yourusername  wget -O /dev/null http://somesite.com/4_leads.php
    

    如果您通过crontab -ecrontab -e -u yourusername 或类似方式将条目放在用户特定的 crontab 中,请跳过用户名字段。

    这个问题可能更适合serverfault

    【讨论】:

      猜你喜欢
      • 2014-08-07
      • 1970-01-01
      • 2019-11-19
      • 1970-01-01
      • 2012-11-02
      • 2017-10-15
      • 1970-01-01
      • 2022-07-07
      • 2014-10-16
      相关资源
      最近更新 更多