Cron 作业停止工作
我每天运行 cron 作业已经几个月了,而且运行良好。 cron 作业运行一个 php 脚本,该脚本执行数据库操作,然后将结果通过邮件发送给我的电子邮件地址。 几天前突然,当脚本运行时,数据库操作停止工作,但它会向我发送电子邮件。我更改了 php 脚本以发送另一封电子邮件,但它仍然向我发送旧电子邮件。 我似乎无法运行任何新脚本,并且当我为 cron 作业设置一个电子邮件地址来运行时,它不会发送一个。
有想过如何让这件事重回正轨吗?
更多信息: 我使用 Linux 操作系统 cPanel。
我使用了以下命令。 /usr/bin/php -f /home/[用户]/public_html/[脚本路径] /usr/bin/php -q /home/[用户]/public_html/[脚本路径] /usr/local/bin/php -f /home/[用户]/public_html/[脚本路径] /usr/local/bin/php -q /home/[user]/public_html/[path to script]
PHP 说 PHP 的路径是 /usr/bin/php 但是,它曾经与那里的本地部分一起工作。
@DampeS8N-我宁愿不。 PHP 脚本仅包含一些sql 命令和一个邮件函数。当浏览器访问时它工作正常,没有任何错误。 @Paul-这就是我倾向于相信的。我认为 Cron 守护进程卡住了。当我尝试添加新的 cron 作业时,它们不会注册为要关闭,并且当 cron 应该关闭时,它不会向我的电子邮件地址发送电子邮件。
我是 cron 的新手。我在 cPanel X 中访问 cron 作业。我很确定我不使用 crontab。如果您希望我采取任何行动的详细说明,那就太好了。
I've been running a daily cron job for a few months and it was working fine.
The cron job runs a php script that does a database action then mails my email address with the results.
Suddenly a few days ago, when the script ran, the database action stopped working, but it would send me the email. I changed the php script to send a different email, but it still sends me the old one.
I can't seem to get any new scripts to run and when I set up an email address for the cron job to run it doesn't send one.
Any thought as to how I can get this back on track?
More information:
I use a linux OS cPanel.
I've used the following commands.
/usr/bin/php -f /home/[user]/public_html/[path to script]
/usr/bin/php -q /home/[user]/public_html/[path to script]
/usr/local/bin/php -f /home/[user]/public_html/[path to script]
/usr/local/bin/php -q /home/[user]/public_html/[path to script]
PHP says that the path to PHP is /usr/bin/php however, it used to work with the local part in there.
@DampeS8N- I'd rather not. The PHP script just includes a few sql commands and a mail function. It works fine without any errors when visited by browser.
@Paul- That is what I am inclined to believe. I think the Cron Daemon is stuck somehow. When I try to add new cron jobs, they don't register as going off, and it won't send emails to my email address when a cron should go off.
I am a complete newbie to cron. I access cron jobs in my cPanel X. I'm pretty sure I don't use crontab. Detailed instructions for any actions you'd like me to take would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我最终联系了我的托管支持人员。事实证明,该域已移动到一台新服务器,而 cron 作业仍在旧服务器上运行。
Well, I wound up contacting my hosting support. Turns out the domain was moved to a new server and the cron jobs were still running on the old one.