CodeIgniter Forums
Codeigniter 2 Cron Jobs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Codeigniter 2 Cron Jobs (/showthread.php?tid=39426)



Codeigniter 2 Cron Jobs - El Forum - 03-10-2011

[eluser]nsbingham[/eluser]
I had been using the a bootstrap file (copy of the index.php file with preset SERVER variables) to launch cron scripts. With CI 2.0 is that still needed? From what it sounds like it's not, but haven't been able to figure out the syntax to launch a controller/method command line. I'd appreciate any help greatly!


Codeigniter 2 Cron Jobs - El Forum - 03-15-2011

[eluser]nsbingham[/eluser]
In case anyone finds this, the syntax is:

Quote:/usr/bin/php index.php welcome cron

The first item is the path to php, second is the path to the index.php file in CI (I've CD'd to the root of my site), the third and fourth items are the controller and method.

With a fresh CI install this works for me. Now to figure out how to get it working with Modular Extensions ...


Codeigniter 2 Cron Jobs - El Forum - 03-22-2011

[eluser]carvingCode[/eluser]
I've been using the cron bootstrap (from wiki) with 1.7.x. I've not had success using it with 2.0.x. It returns a CI error page saying there are unallowed characters in the URL.

Is there another method for calling cron jobs in 2.0.x?

TIA

EDIT: I used the format above and all is working great. Simple things...


Codeigniter 2 Cron Jobs - El Forum - 08-01-2011

[eluser]webnology[/eluser]
Hi all,

I need some more info on this? What do I need to pass to my hosting support, to run a specific method controller/method? Simply the above lines?

Thx,
Michel


Codeigniter 2 Cron Jobs - El Forum - 08-01-2011

[eluser]nsbingham[/eluser]
Are you trying to have them set up a CRON job for you? If so, your host should know the path to the PHP install on the server. I'm guessing if you don't have root access they'll have to fill in that information for you. They might also need to fill in the path to your CodeIgniter install's index.php file as well. You'll need to provide them the controller and method to call. I'd send them something like the following where you replace my_controller and my_method with the controller and method you're trying to call.

/path/to/php /path/to/your/index.php my_controller my_method


Codeigniter 2 Cron Jobs - El Forum - 08-02-2011

[eluser]webnology[/eluser]
ok thx. I'll give that a try.

Michel


Codeigniter 2 Cron Jobs - El Forum - 02-03-2012

[eluser]Unknown[/eluser]
Using CodeIgniter 2 with Modular Extensions (MX), I use the following CLI syntax for cron jobs:

Code:
/usr/bin/php /var/www/index.php ModuleName/ModuleClass moduleMethod arg1 arg2 arg3

If ModuleName and Module class are the same, then you don't need them both...

Code:
/usr/bin/php /var/www/index.php ModuleName moduleMethod arg1 arg2 arg3

Where /usr/bin/php is where the php interpreter lives, and /var/www/ is the web server's document root.


Codeigniter 2 Cron Jobs - El Forum - 02-04-2012

[eluser]imarek[/eluser]
Hey CI2I. It worked for me too. Smile Thanks for sharing.