Cron job in yii2

Hello Yii friends,

Currently I am trying to built cron job in yii2 in basic application.I am using linux system.

Inside commands/HelloController

public function actionIndex()


{


	mail('hello@hello.com', 'hello', 'hello');


}

Using Terminal and giving following commands=>

/var/www/busroute $ php yii hello

it works for me

But I am trying put the script in crontab. I have tried different ways but it does not work for me.I want the command run in every minute.For that I am using such script in crontab

          • /usr/bin/php /var/www/busroute/commands/hello/ cronjob >/dev/null

I cannot figure out what I am missing. I would really appreciate the help and thank you very much in advance.

Hi,

It should be something like this:

          • /usr/bin/php /var/full_path_to/yii.php hello > /dev/null

<br />

In any way. You can try to run each comand in the linux’s terminal before write it in cronjob.