CentOS上的Cron没有正确执行php脚本 [英] Cron on CentOS not properly executing a php script

查看:107
本文介绍了CentOS上的Cron没有正确执行php脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有php脚本我正在尝试使用cron定期执行。



我这样做是通过修改crontab文件。



crontab内容:

Hello,
I have php scripts I'm trying to execute routinely using cron.

I'm doing this by modifying the crontab file.

crontab contents:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
*/10 * * * * root /usr/bin/php /var/www/html/cron_update_statuses_one_hour.php
0 */03 * * * root /usr/bin/php /var/www/html/cron_update_statuses_three_hour.php
0 */08 * * * root /usr/bin/php /var/www/html/cron_update_statuses_eight_hour.php
0 */16 * * * root /usr/bin/php /var/www/html/cron_update_statuses_sixteen_hour.php
0 0 * * * root /usr/bin/php /var/www/html/cron_update_statuses_one_day.php







cron log:






cron log:

Jul 13 00:10:01 s1 CROND[2944]: (root) CMD (cd /var/www/html/ /usr/bin/php cron_update_statuses_one_hour.php)
Jul 13 00:12:01 s1 crond[2124]: (*system*) RELOAD (/etc/crontab)
Jul 13 01:00:01 s1 CROND[2977]: (root) CMD (/usr/sbin/raid-check)
Jul 13 01:01:01 s1 CROND[2992]: (root) CMD (run-parts /etc/cron.hourly)
Jul 13 01:01:01 s1 run-parts(/etc/cron.hourly)[2992]: starting 0anacron
Jul 13 01:01:01 s1 anacron[3001]: Anacron started on 2014-07-13
Jul 13 01:01:01 s1 run-parts(/etc/cron.hourly)[3003]: finished 0anacron
Jul 13 01:01:01 s1 anacron[3001]: Jobs will be executed sequentially
Jul 13 01:01:01 s1 anacron[3001]: Normal exit (0 jobs run)
Jul 13 01:07:01 s1 crond[2124]: (*system*) RELOAD (/etc/crontab)
Jul 13 01:10:01 s1 CROND[3022]: (root) CMD (/usr/bin/php /var/www/html/cron_update_statuses_one_hour.php)
Jul 13 02:01:01 s1 CROND[3059]: (root) CMD (run-parts /etc/cron.hourly)
Jul 13 02:01:01 s1 run-parts(/etc/cron.hourly)[3059]: starting 0anacron
Jul 13 02:01:01 s1 anacron[3068]: Anacron started on 2014-07-13
Jul 13 02:01:01 s1 anacron[3068]: Jobs will be executed sequentially
Jul 13 02:01:01 s1 anacron[3068]: Normal exit (0 jobs run)
Jul 13 02:01:01 s1 run-parts(/etc/cron.hourly)[3070]: finished 0anacron
Jul 13 02:10:01 s1 CROND[3072]: (root) CMD (/usr/bin/php /var/www/html/cron_update_statuses_one_hour.php)





100%确定php位置正确; 100%确定cron服务正在运行; 100%确定我的脚本的位置是正确的



此外,是的,我知道我的第一个条目设置为每10分钟运行一次该命令,我只做了这个出于调试目的,请假装它每小时运行一次



请帮助* nix专家:D!



谢谢



100% sure that php location is correct; 100% sure that cron service is running; 100% sure that the location of my scripts are correct

Also, yes I realize that my first entry is set to run that command every 10 minutes, I did this only for debugging purposes, please pretend its set to run it every hour

Please help *nix experts :D !

Thank you

推荐答案

这篇关于CentOS上的Cron没有正确执行php脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆