CodeIgniter Forums
Cron Job - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Cron Job (/showthread.php?tid=64433)



Cron Job - Bhavesh - 02-19-2016

Hi friends

How to call controller and action using cron job?

my cron action's absolute path is below

/[FOLDER_NAME]/[USERNAME]/public_html/index.php/[CONTROLLER_CRON]/[CONTROLLER_ACTION]

If I set above path in cpanel cron job task than server return path not found error, and also I have created one test file on root than server give permission error.

I am using bluehost shared hosting server

Sorry for my bad English ,please help me


RE: Cron Job - Krycek - 02-19-2016

Please try

Code:
index.php welcome show

So that would be (changes / for spaces)

Code:
/[FOLDER_NAME]/[USERNAME]/public_html/index.php [CONTROLLER_CRON] [CONTROLLER_ACTION]



RE: Cron Job - keulu - 02-19-2016

see the doc Smile http://www.codeigniter.com/user_guide/general/cli.html

example.com/index.php/tools/message/to

->

$ cd /path/to/project;
$ php index.php tools message "John"

OR

$ php /path/to/project/index.php tools message "John"


RE: Cron Job - Bhavesh - 02-19-2016

Thanks to all for valuable reply.

And below code is working for me.
CI uses CLI requests. Means you have to use PHP CLI to use this cron job properly. From SSH in crontab view it should be similar to:


/usr/bin/php-cli /home/[CPANEL_USER]/public_html/index.php [CONTROLLER_NAME] [METHOD_NAME]