Cron Jon With Code Igniter |
[eluser]Zion.b.y[/eluser]
hallow everyone, I've opened with New Topic because I've noticed that there is not much info about cron jobs. i have a few questions about cron jobs with code igniter and about cron specific: 1. what is the cron job command in order to operate a php code i.e. lets say i have a php page with some php code and i want to run it every sunday, what is the cron command for it. 2. if my php code is in a function in a controller, do i simply enter the http... link? i would be happy to get a quick tutorial about the cron jobs, and not just how to create a cron job but also how to reffer the job to the php code, thanks a lot everyone Zion P.S - do not direct me to the http://codeigniter.com/wiki/Cron_job_bootstrapper/ because i only have access to the cPanel, i don't have access to the root of the host
[eluser]Zeeshan Rasool[/eluser]
Yes it is possible to make a separate controller or existing one, with a common function who does a simple job, something like to delete the expired records. Then give your full path to that function like this: http://yourdomain.com/controller/function.
[eluser]Mat-Moo[/eluser]
The boot strapper is requird to allow CI to run as a CRON job. Then in cpanel use Code: /usr/local/bin/php -q /xxx/website/cron.php --run=/controller/function/params /xxx/website/cron.php path from document root to your cron.php (from the bootstrapper wiki)
[eluser]Zion.b.y[/eluser]
What is the cron.php ? does it exists in the server automatically or should i create it? and shouldn't i use the wget <path> in order to run a php code i entered to the cPanel and i understood the logic of the scheduler. For example, i know now how to run the order i will enter there every Sunday, but lets say i have in my root /mysite/controllers/resetDB.php what is the exact order i should type in the cPanel (without the schedule of course) in order to run this page thanks, Zion
[eluser]Mat-Moo[/eluser]
The wiki article has the CRON.php file you require. As long as all the files are on the server you don't need wget or anything. So you just need --run=/resetDB (You want the controll name not file name) assuming resetDB is not a function in a controller, otherwise it would be --run=/mycontroller/resetDB |
Welcome Guest, Not a member yet? Register Sign In |