Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 2 Cron Jobs
#1

[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!
#2

[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 ...
#3

[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...
#4

[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
#5

[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
#6

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

Michel
#7

[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.
#8

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




Theme © iAndrew 2016 - Forum software by © MyBB