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
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bf89-2b01c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bf89-2b01c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?