如何在服务器上的特定时间里每分钟运行一次cron作业

时间:2018-12-08 10:20:51

标签: php cron

在这里,我试图通过cron作业过程运行php文件。我想从4PM到5PM每分钟运行该php文件。我都尝试过

*   16-17   *   *   *   

还有

*   16,17   *   *   *   

但是它不起作用。我应该如何编写确切的命令来运行它?

1 个答案:

答案 0 :(得分:1)

要在cron作业中包含多个特定值,请用逗号分隔它们。

对于16-17岁,您想要16,17,以便获得:

# m |  h  | d | m | Day of week
  *  16,17  *   *   *

# All the below can include multiple values using commas
# m = minute (minute from 0 to 59)
# h = hour (hour of the day, from 0 to 23)
# d = day (day of month, from 1 to 31)
# m = month (month of the year, where 1 is January)
# dow = day of the week (0-7 where 0 and 7 are Sunday)