How to run a CodeIgniter file through CRON?

后端 未结 6 1543
旧时难觅i
旧时难觅i 2021-01-31 00:16

I\'ve tried the following method in the past:



        
6条回答
  •  滥情空心
    2021-01-31 00:45

    The simplest way to run a cron via CodeIgniter is to make a cron URL available via your app.

    Then call it via wget

    wget -O - -q -t 1 http://www.example.com/cron/run
    

    Inside the controller you can then use a log to ensure the cron is not run too often i.e. if the Google robots trigger it by mistake.

    A second method would be to use lynx

    /usr/local/bin/lynx -source http://www.example.com/cron/run
    

提交回复
热议问题