Phil Young
Phil Young

Reputation: 1364

Codeigniter cron job issue

I have a cron job which needs running on my site. I have set up the model and controller, then set the following cron job to run every hour:

/usr/bin/php /path/to/directory/index.php cron resetViews;

I have the URI_PROTOCOL index of $config in my config.php file is set to AUTO and there are no spelling errors.

When I run the command, I get the4 html of my home page, which is also my default controller. Any ideas?

Edit

I have changed the command to:

cd /path/to/directory; /usr/bin/php index.php cron resetViews;

and now I get the following error on top of a printout of my home page:

PHP: Error parsing /home/crowston/public_html/2012/php.ini on line 1

Here is my entire php.ini file:

error_reporting(E_ALL);
ini_set('display_errors', 'On');

I have also tried with a blank php.ini fie to no avail.

The php.ini file has caused no errors throughout the entire construction of the site :S

Upvotes: 0

Views: 998

Answers (2)

AngularJMK
AngularJMK

Reputation: 1278

It works fine for me :

wget -O /dev/null -q http://www.mani.com/project-name/index.php/tools/sendPushNotification

(-O /dev/null -q) Command is used to remove log file

Upvotes: 0

Prasanth
Prasanth

Reputation: 5268

You can try this:

wget http://localhost/index.php/cron/resetViews

Basically, since you have the capability to use wget that will definitely call the controller method, why use cli?

EDIT:

referring to this, perhaps you should do a cd command to the directory and then call index.php. Worth a try because if ci was trying to load controller from path relative to the cron's pwd, then it might throw a 404. right?

Upvotes: 4

Related Questions