用于PHP yiic命令的Cron作业
问题描述:
I have created a php yiic command as
class StartCommand extends CConsoleCommand {
public function run($params){
Yii::log("Cron Job has started");
}
}
When I run the command php yiic Start
, I get the result in the log.
And I have add this to the crontab
* * * * * /usr/bin/php /path/app/console/commands/StartCommand.php
But the job is not running. I think I have to mention the php yiic Start to the crontab.
But where do I add it ??
我创建了一个php yiic命令为 p>
类StartCommand 扩展CConsoleCommand {
公共函数运行($ params){
Yii :: log(“Cron Job已启动”);
}
}
code> pre>
当我运行命令 php yiic Start code>时,我会在日志中得到结果。 p >
我已将此添加到crontab p>
* * * * * / usr / bin / php / path / app / console / commands / StartCommand.php
code> pre>
但作业没有运行。
我想我必须提到php yiic Start to the crontab。 p>
但是我在哪里添加它? p>
div>
答
* * * * * cd /path/app/console/commands && php yiic Start