简体   繁体   中英

Running codeigniter 3 cron job issue

I'm trying to run a codeigniter 3 cron job. If I open the file manually it works through the browser and I find databse updated and emails are sent

https://www.example.com/module_name/controller/method

But not working through a cron job like this every minute on a private server

curl --silent https://www.example.com/module_name/controller/method

Also tried

/usr/local/bin/php /home/username/public_html/index.php module_name controller method

Any idea or other ways to run it?

I'd first go to a terminal and check that your php is actually at /usr/local/bin/php by running:

which php

You mentioned that you'd like to know other ways to run the cron, and I've used wget many times. For you that would look something like:

/usr/bin/wget https://www.example.com/module_name/controller/method -O /dev/null

In most(all?) Linux distros, you're going to open crontab for editing using:

crontab -e

Once in there, just add a line:

* * * * * /usr/bin/wget https://www.example.com/module_name/controller/method -O /dev/null

Do ensure that you have wget available, and it's location by running:

which wget

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM