Reputation: 5461
How do we use a normal Zend Framework 2 controller action (callable from browser) as a cron job? I tried to set one as a cron job but it did not get called.
Do we need a Rest(ful) controller/module for that?
Upvotes: 2
Views: 2748
Reputation: 5461
I converted my action into Rest(ful) module action, and it worked.
Reference:
http://hounddog.github.com/blog/getting-started-with-rest-and-zend-framework-2/
The command set through Cpanel of my server:
curl http://myurl.domain
Upvotes: 1
Reputation: 1475
Read this: http://framework.zend.com/manual/2.0/en/modules/zend.console.introduction.html
This explains console routes in a great deal and walks through the process of setting one up.
I used it just last week and it proved very helpful. Console routes can be set up so they are restricted from access via the web.
You could then set up a cron job to just run:
php \path\to\site\public\index.php -switch1 param1
Upvotes: 2