StErMi
(Stermi)
1
I want to use a cronjob to launch a yii action of a controller in order to use all the yii models and AR.
For example I want to launch the action "updateHtcheck" in the controller "HtCheck".
How can I do?
Something like:
* * * * * /usr/local/bin/php -q /path/to/youryii/protected/controller/HtCheck/updateHtcheck
Can someone help me? Thanks
samdark
(Alexander Makarov)
2
GET http://example.com/cron/
wget -O - http://example.com/cron/
lynx --dump http://example.com/cron/ >/dev/null
StErMi
(Stermi)
3
fixed.
The real problem is that my script is REALLY big and so I’m afraid about:
-
timeout
-
memory usage.
So I was talking about executing the php script…
samdark
(Alexander Makarov)
4
You can’t really just execute controller because it’s a part of web application that is not available at console.
What you can is move all logic from controller to a model/component/class and then use it in console command: http://www.yiiframework.com/doc/guide/topics.console
xx666xx
(Jerryablan)
5
I do this in almost all my projects.
I have a controller called CronController. It has actions like "actionPurgeCache".
In my crontab, I just use wget to pull that: http://url/cron/purgeCache