How to set cron job url for codeigniter?

Sachin picture Sachin · Oct 9, 2013 · Viewed 94.9k times · Source

I am using Codeigniter for my website. I have to use cron job to run one of controller function. I am using route in website. And also I am not using index.php in url.

e.g. http://my-domain.com/welcome/show, here welcome is my controller and show is function name of that controller.

I have used like this,

0 * * * * php /home/username/public_html/welcome/show

It is giving 'No such directory'

How can I set cron jon in CPANEL for above url.

Thanks.

Answer

unicorn80 picture unicorn80 · Oct 9, 2013

Use:

php index.php welcome show

as command in your crontab. E.g.:

0 * * * * php /home/username/index.php welcome show

Source (ver. 2.2.0) http://www.codeigniter.com/userguide2/general/cli.html

Source (ver. 3.*) http://www.codeigniter.com/user_guide/general/cli.html