Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cron jobs in codeigniter

I am trying to do a cron job with a site built in CodeIgniter - I've got access to the CPanel cron feature can anyone suggest the best way to setup a cron job using CPanel?

I am using CodIgniter so cannot be sure how to call a controller within a cron job?

E.g http://admin.com/sites/publish/

How would I access this publish function within the sites controllers using a cron job?

like image 436
Zabs Avatar asked Sep 06 '11 15:09

Zabs


1 Answers

Best way is to call from the command line in the cron job...

php /path/to/index.php controller >> /dev/null

You can run controllers via the command line in CI, see here.

like image 148
fire Avatar answered Sep 22 '22 15:09

fire