简体   繁体   English

设置特定时间后CRON作业无法运行

[英]CRON job doesn't run when I set a specific time

I want to run a CRON command on certain days of the month at different times. 我想在每月的某些天的不同时间运行CRON命令。

I have set up the CRON as indicated below: 我已按如下所示设置了CRON:

40 8 5 12 6 php /home/username/public_html/path_to_php_script 40 8 5 12 6 PHP /家庭/用户名/ public_html / path_to_php_script

This is supposed to run at 8:40am on 5th December I presume but it never does. 我猜这应该在12月5日上午8:40运行,但从未成功。

I noticed it only works when I use the common settings: 我注意到它仅在使用通用设置时才有效:

Example: */5 * * * * php /home/username/public_html/path_to_php_script 示例:* / 5 * * * * php / home / username / public_html / path_to_php_script

This is supposed to run every five minutes 这应该每五分钟运行一次

I have read a lot of suggestions on StackOverflow and other articles including the official documentation on cPanel.net all to no avail. 我已经阅读了很多有关StackOverflow的建议以及包括cPanel.net上官方文档在内的其他文章都无济于事。

Any suggestions? 有什么建议么?

Thanks in advance. 提前致谢。

You must not set the weekday. 您不得设置工作日。 Just any (*) day. 任意(*)天。
40 8 5 12 * php /home/username/public_html/path_to_php_script 40 8 5 12 * php / home /用户名/ public_html / path_to_php_script

The timezone was the problem in my case. 就我而言,时区就是问题所在。 The CRON job actually works fine but the time on the server was 8 hours behind so I had to back date the time. CRON作业实际上可以正常工作,但是服务器上的时间晚了8个小时,所以我不得不回溯时间。

You could also change the time on the server if you had access to the WHM. 如果可以访问WHM,也可以更改服务器上的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM