TP5 framework, crontab in centos executes its own method, solving

this is a custom route in my crontab to access myself. This route is circular data. If there is a change in status, push Wechat messages to users

  1 * * * * * /usr/bin/curl http://mp.hdhra.com/newshell
  
  : admin/Index/newshell
  
  
  
Mar.18,2021

has not used thinphp5, to provide ideas.

ThinkPHP5.0 supports Console applications and performs some operations with inconvenient URL access or high security through the command line.

do not read the thinkphp document carefully. You can first check whether there is a task scheduling feature in the document (see laravle task scheduling ). If not, take a look at thinkphp command line No longer use access routing to achieve your scheduled tasks


you can change the way you access url. ThinkPHP can customize the command line custom command line
to write the logic of" circular data, push Wechat message to the user if there is a change in status "into the command line. It does not need to be triggered by accessing url, and it can avoid security problems, resource problems of nginx, and so on.

1 * * * * * /usr/bin/php think test
Menu