如何让cron工作每天6点钟';Cpanel的时钟


how to make cron job every day at 6 O'clock by Cpanel

Cpanel如何让cron每天6点工作?我通过我的面板添加了cron作业作为这张图片

https://i.stack.imgur.com/5esAq.jpg

但是脚本一天中工作不止一次,我需要知道cron或我的脚本中的错误。

因为有星号,您的cron将每分钟在6点钟运行一次。

Cron格式:

* * * * * *
| | | | | | 
| | | | | +-- Year              (range: 1900-3000)
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)
Any of these 6 fields may be an asterisk (*). 
This would mean the entire range of possible values, i.e. each minute, each hour, etc.

你应该放0分钟,因为你只需要运行一次(06:00)。

0 6 * * * 

您应该更改您的cronjob,如下所示:

0 6 * * * /usr/bin/php and so on

这样它将在6点钟运行。按照你的方式,它将在6点开始运行,然后每分钟运行一次,持续一个小时。

例如,如果你想让一个脚本在一个月的第三天午夜运行,你应该写:

0 0 3 * * /usr/bin/php and so on

如果在前两个字段上留下星号,它将运行一整天。

看看手册页。一些示例可能非常有用,例如具有@daily宏的示例。