ashir haroon
ashir haroon

Reputation: 243

cronjob is not running with codeigniter

This is my cronjob command. I am using codeigniter.

curl -s https://duainternational.com.pk/update_system/employee/test_notification >/dev/null 2>&1
cron time

M   H   D   M   Weekday
5   *   *   *   *

What am I doing wrong? I cannot get the cronjob running

Upvotes: 0

Views: 352

Answers (2)

DFriend
DFriend

Reputation: 8964

Assuming you want to run a controller/method/argument on CodeIgniter then try using command line interface (CLI). (Documentation)

You need to supply the full system path to CodeIgniter's index.php file. I'm making assumptions about that path. Substitute your systems path to index.php.

php /var/www/website/public_html/index.php update_system/employee test_notification

Other assumptions I'm making are that the employee controller is on this path /application/controllers/update_system/ and the method you want to run is test_notification.

Know that when using the CLI you cannot use the session class. If you attempt to use sessions the CLI request will fail.

Upvotes: 0

Alexandre Tranchant
Alexandre Tranchant

Reputation: 4551

On cron job, paths are not known. So, prefix curl with its path.

If curl is in /usr/bin/, you shoul write:

/usr/bin/curl -s https://example.com/ >/dev/null 2>&1`

Upvotes: 1

Related Questions