I have created a Yii command that needs to be run every month. If I go to my protected folder and run the command manually:
protected/yiic ganadores
It works fine. I have tried to add the following command line to etc/cron.hourly and etc/crontab with no success:
/usr/bin/php5 /var/www/path/to/project/protected/yiic ganadores (etc/cron.hourly/ganadores)
0 0 1 * * root /usr/bin/php5 /var/www/path/to/project/protected/yiic ganadores
(etc/crontab)
If I run the file ganadores inside etc/cron.hourly manually, it’s working also.
What am I missing here?
Edit: Finally got it solved. I had some extra spaces in the cron line. Used tab instead spaces and it started working..
This is how I run my Yii cron jobs (in the root crontab file):
Basically just regular crontab syntax, but I am running console.php instead of yiic, and I am setting the user to Apache (www-data) so the permissions are correct for my script. I am not sure why yours isn’t working, but hopefully looking at mine will help you out. 🙂