Cpanel CronJob一周中的几天

时间:2015-08-06 06:58:02

标签: cron cpanel

我是cron职位的新手,我想在一周的几天内运行一个脚本

我确实创建了一个CronJob,但它昨晚没有运行 我想每天晚上00:10到星期四执行剧本

所以我把这个添加为作业
10 00 * * 0,1,2,3,4 execute.php

有人可以告诉我我做错了吗?

2 个答案:

答案 0 :(得分:0)

将其设置为每日运行,只需将其添加到脚本顶部

即可
if (date('l') == 'Friday' || date('l') == 'Saturday') exit;

除非是你需要的一天,否则它甚至都不会做任何事情,让你头疼。

答案 1 :(得分:0)

shell上的root用户(WHM / Cpanel over Centos)

# crontab -e  #Edit cron jobs for user root

10 00 * * 0,1,2,3,4  /usr/local/cpanel/3rdparty/bin/php /full/path/to/execute.php >/dev/null 2>&1  #If not like report to email

用户cpanel shell access

$ crontab -e  #Edit cron jobs for user

10 00 * * 0,1,2,3,4  /usr/local/cpanel/3rdparty/bin/php /full/path/to/execute.php >/dev/null 2>&1  #If not like report to email 

or

10 00 * * 0,1,2,3,4  /usr/bin/php /full/path/to/execute.php >/dev/null 2>&1  #If not like report to email

没有shell访问

Enter Cpanel and go to Cronjobs.
Put your tiem on each text input area.
Put your job 10 00 * * 0,1,2,3,4  /usr/local/cpanel/3rdparty/bin/php /full/path/to/execute.php >/dev/null 2>&1  #If not like report to email

<强>说明

/ usr / local / cpanel / 3rdparty / bin / php为WHM / Cpanel函数编译的PHP。

/ usr / bin / php 正常 Cpanel安装使用的PHP

如果您的服务器使用了其他路径,例如,Canlinux可以使用多个PHP版本。

相关问题