Home > other >  How to run a Codeigniter php file using cronjob in ubuntu?
How to run a Codeigniter php file using cronjob in ubuntu?

Time:06-19

So i have this php function path in codeigniter which I am trying to run through cron job in ubuntu. But whatever I have tried it is not working. The command I have tried so far

* * * * * /usr/bin/php http://localhost/QAPIv2/updateTestData

But it is not executing. I am using codeigniter

CodePudding user response:

To elaborate on Rohan's answer, you run the functions like php index.php controller function. So, for example, to run your script every Tuesday at 8:31AM, your crontab entry should look like :

31 08 * * 2 cd /path/to/codeigniter; /usr/bin/php index.php QAPIv2 updateTestData;

CodePudding user response:

Please call the function from the command line.

$ cd /path/to/project;
$ php index.php controller function

Please change the controller and function according to your code.

  • Related