Monitor the PHP process and error log check shell1: when asynchronous processing is performed, the program will inevitably fail. this shell can be used to listen to the PHP script process processed by the queue, if the process is dead, it will restart. #! Binbashprocess 'PS-ef | grepwwwprojecthandle. php | grep-vgrep | wc-L' if [$ process-e monitor the shell for PHP process and error log Check
1: some asynchronous processing may inevitably result in program failure. this shell can be used to listen to the PHP script process processed by the queue. if the process dies, it will be restarted.
#! /Bin/bashprocess = 'PS-ef | grep'/www/project/handle. php' | grep-v grep | wc-l 'if [$ process-eq 0]; then/usr/bin/php/www/project/handle. php # You can also record the log here to learn about the fi
2: in actual development, interface interaction between layers or systems is inevitable. However, some core interaction logs are essential. Once an exception occurs during the interaction process, developers must be notified quickly.
#! /Bin/shnow = 'date + % Y % m % d % H' # The current time ends in the hour logPath =/data/log/# log directory thisIp = 'ifconfig- | grep inet | grep-v 127.0.0.1 | grep-v inet6 | head-n1 | awk '{print $2}' | tr-d "addr: "'# if the program is published to multiple machines, retrieve the IP address of the current machine # errorLogFile = 'find $ logPath-name $ errorBegin "*. log "'# if you are looking for all error logs, use this fileName = $ now" _ test_error.log "# if [-f" $ logPath $ fileName" ]; thenecho $ thisIp "server have error log;-logpath: "$ logPath $ fileName | mail-s server error log [email protected] # send mail to relevant personnel # if there is an implemented notification mechanism, execute this program here to fi