【发布时间】:2016-06-17 04:32:43
【问题描述】:
您好,我在我的 cpanel 中设置了一个每分钟运行的 cron 作业:
/usr/bin/php /home/mysite/public_html/index.php --uri="cron/test"
上面的 cron 正在通过我的 index.php,因为如果它在我的 cron 控制器“cron/test”上没有运行,我会记录它。
在我的 index.php 中,我这样做只是为了测试目的,我得到了 indexcall.txt:
$fp = fopen('indexcalled.txt', 'a+');
fwrite($fp, "POST: " . serialize($_POST));
fwrite($fp, '-----------');
fwrite($fp, "GET:" . serialize($_GET) . "\r\n");
fclose($fp);
在我的 Cron 控制器中我有这个,但我没有得到 crontest.txt
public function action_test() {
$fp = fopen('crontest.txt', 'w+');
fwrite($fp, date("Y-m-d H:i:s") . "cron test initiating...\n\n");
fclose($fp);
}
有什么我做的不对或者我可能忘记设置了吗?
【问题讨论】: