简体   繁体   English

Cron作业未运行

[英]Cron job is not running

I've tried just about everything to get my cron script to work but am not having any luck. 我已经尝试了几乎所有方法来使我的Cron脚本正常工作,但是没有任何运气。 I've been through many mini tutorial several times too! 我也经历过许多迷你教程! Here's what I'm trying to run... 这是我要运行的内容...

    /usr/bin/php -q /home/username/public_html/yourfilename.php

On cpanel even i am not getting email after running time of my crone job. 在cpanel上,我的老太婆工作时间结束后,我什至没有收到电子邮件。 thank you 谢谢

尝试这个

/usr/bin/php -q /home/username/public_html/yourfilename.php >/dev/null

You need to check below points. 您需要检查以下几点。

  1. The file location is correct. 文件位置正确。
  2. check that the crond services running or not. 检查crond服务是否在运行。 you can check with below commend : 您可以通过以下命令查看:

    /etc/init.d/crond status /etc/init.d/crond状态

and you should get status running with pid. 并且您应该获得使用pid运行的状态。 if you can got it then move on point 3 otherwise. 如果可以的话,请继续前进到第3点。 try to restart the cron service via below command: 尝试通过以下命令重新启动cron服务:

/etc/init.d/crond restart /etc/init.d/crond重新启动

and check the logs via below command : 并通过以下命令检查日志:

tail -f /var/log/cron 尾-f / var / log / cron

  1. if you getting the cron service working then check your lfd service working on not. 如果您使cron服务正常工作,则请检查lfd服务是否正常工作。

    /etc/init.d/lfd status /etc/init.d/lfd状态

if its running then check your email proper configure on lfd. 如果它正在运行,则检查您的电子邮件是否在lfd上正确配置。

  1. if lfd fine then run below command as root to add cron 如果lfd罚款,然后以超级用户身份在命令下运行以添加cron

    crontab -e crontab -e

give your cron at the end of file with correct format. 在文件末尾使用正确的格式提供cron。

sure that time it will work. 确保那段时间会奏效。

if getting any issue in any point. 如果在任何时候遇到任何问题。 let me know here. 让我知道这里。

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

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