Rishi Shrivastava
Rishi Shrivastava

Reputation: 301

Cron Job in codeigniter

I want to create and use cron job . But i want it to be done by my script in codeigniter. So is it possible to add a cronjob for a perticualr time when my conrtoller function is completed ?

If so please help... Thank you

Upvotes: 0

Views: 612

Answers (2)

taiar
taiar

Reputation: 562

Sure you can!

You can execute any controller/action in codeigniter on command line this way:

php index.php controller_name action_name

So you can point a cron job on this particular route and execute anything that don't depends on browser (like sessions/cookies) into your job.

More info: http://www.codeigniter.com/user_guide/general/cli.html

Upvotes: 2

Sandeep Singh
Sandeep Singh

Reputation: 41

You can use curl in cron jobs to execute or run the codeigniter in cron jobs

* * * * * /usr/bin/curl https://www.domain.com/controller/function

Upvotes: 0

Related Questions