Task scheduling in PHP MVC Codeigniter

I want to schedule a task that is a controller method in MVC CodeIgniter. In addition, I want to add a parameter in my web application for the administrator to change the schedule, and not work with the Windows task scheduler manually. I found some examples for the PHP Web Form scheuler, but not for the MVC CodeiIgniter! Could you guide me in this regard?

If my question is not clear, let me know what part you need for clarification!

Thank you very much in advance,

+7
php scheduler scheduled-tasks codeigniter
source share
2 answers

First of all, task planning is a basic OS operation, so you cannot manage it through the application if you do not have full rights to your server, however there are some ways you can achieve this Check this article to help you learn how CI manages the cron job.

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

+1
source share

I'm not sure if I understood your question, but to schedule a task, if you are running on a linux server, you can use the cron job.

Suppose you have a controller called Welcome with a function called task, then you can use a cron job like this:

Cron_configuration task path_to_bin_php index.php task

Here is a link to more information about cron:

http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples

0
source share

All Articles