Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheduling a task in PHP MVC Codeigniter

I want to schedule a task which is a controller method in MVC CodeIgniter. Also, I want to add the option in my web application for the admin to change the schedule instead of working around windows task scheduler manually. I found some examples for PHP Web Form scheuler but not for MVC CodeiIgniter! Could you please guide me in this regard?

If my question is not clear please let me know which part you need more clarification!

Many thanks in advance,

like image 667
user385729 Avatar asked Oct 20 '13 00:10

user385729


1 Answers

First of all scheduling a task is a OS base Operation, so you cannot control it through your application unless you have full rights to your server, however there are some ways where you can achieve this Check this article it will help you about how CI controls the cron job.

If you want to change/create the time of the cron job through your application then you can use exec function which will execute your passed command in the shell of windows but remember this function will only work when your hosting provider has enabled it or you have rights to this function and this answers will tell how you can use schedule task (CronJob) on Windows through command line.

like image 175
Touqeer Shafi Avatar answered Sep 25 '22 07:09

Touqeer Shafi