Search code examples
phpyiicronyiic

Cron job for PHP yiic command


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 ??


Solution

  • * * * * * cd /path/app/console/commands && php yiic Start