Cron Job to execute Yii controller action

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 :)


wget -O -

lynx --dump >/dev/null


The real problem is that my script is REALLY big and so I’m afraid about:

  1. timeout

  2. memory usage.

So I was talking about executing the php script…

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:

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