I need a crontab job.I can execute it directly under LIniux console,but I can’t execute under crontab.
file:/commands/CrontCommand.php
<?php
/*
-
系统定时程序管理程序
-
Author:Xiangwei.Guo
-
*/
class CrontCommand extends CConsoleCommand
{
public function actionEvery1Month() {
echo date("Y-m-d H:i:s")."\r\n";
}
}
I can run it on my linux console side like this:
/usr/local/apache/htdocs/ldc/protected/yiic cront every1Month >>/var/tmp/ldc_contt_log
It works well.I can see the log in file :ldc_contt_log.
So I put it under contab like this :
*/1 * * * * /usr/local/apache/htdocs/ldc/protected/[color="#FF0000"]yiic[/color] cront every1Month >>/var/tmp/ldc_contt_log
*/1 * * * * ls >> /var/tmp/a.log
I put another shell command under crontab in order to confirm that the crontab job is working .Finally ,I see the log information in this file:a.log and see nothing in this file:ldc_contt_log.
My crontab job don’t work.I’am confused about that.What’s wrong with my program.
[color="#FF0000"]yiic[/color] is a shell like this :
#!/usr/bin/env php
<?php
require_once(dirname(FILE).’/yiic.php’);