How to set cron job url for codeigniter?

前端 未结 13 1711
一个人的身影
一个人的身影 2020-11-30 23:17

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.

相关标签:
13条回答
  • 2020-11-30 23:40

    You can also try:

    0 * * * * /usr/bin/curl --silent --compressed http://my-domain.com/welcome/show
    

    Or localhost

    0 * * * * /usr/bin/curl --silent --compressed http://localhost/welcome/show
    

    I hope that is helpful.

    0 讨论(0)
  • 2020-11-30 23:41

    I have done it as

     00 09-18 * * 1-5 /usr/bin/php /var/www/html/app/index.php crontest
    

    crontest is the name of the controller which also uses a model to pull data from the database and send mail periodically (between 9 AM to 6 PM on Monday to Friday every week)

    I just viewed this page which explains very detail with example. Hope this will be useful to others as well.

    0 讨论(0)
  • 2020-11-30 23:42

    You can try with this one:

    wget api.example.com/index.php/controller/function
    
    0 讨论(0)
  • 2020-11-30 23:43

    I have used below cron

    php /full-path-to-cron-file/cron.php /test/index
    

    source: http://www.asim.pk/2009/05/14/creating-and-installing-crontabs-using-codeigniter/

    This works for me.

    Thanks to all

    0 讨论(0)
  • 2020-11-30 23:43

    /usr/local/bin/php /home/username/public_html/index.php controllername methodname

    This worked for me.

    0 讨论(0)
  • 2020-11-30 23:43
    watch -n60 curl [your application path]/check_banalce/user_balance
    

    in my case im using codeigniter and the above command executes the user_balance function which is found in check_balance controller every 60 sec.

    0 讨论(0)
提交回复
热议问题