ConsoleCommand can't work under crontab

I need a crontab job.I can execute it directly under LIniux console,but I can’t execute under crontab.




  • 系统定时程序管理程序

  • Author:Xiangwei.Guo

  • */

class CrontCommand extends CConsoleCommand


    public function actionEvery1Month() {


	     echo date(&quot;Y-m-d H:i:s&quot;).&quot;&#092;r&#092;n&quot;;



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



I fix the problem.

I edit my crontab like the following and it works well.

*/1 * * * * /usr/local/php/bin/php /usr/local/apache/htdocs/ldc/protected/yiic cront every1Month

Don’t care about the time,It’s just for a test.So it will execute every minute.