It runs continuously through the background, and restarts if any problem is detected. There are few script codes, the statements are very simple, and the consumption of system resources is very low. You can try it. It seems stupid, but it is effective ~ #! /Bin/bash # checkphp-fpmserverup/downTelLog =/tmp/telphp. logwhile: dosleep15;/usr/bin/telnet127.0.0.19000 & lt; & l
It runs continuously through the background, and restarts if any problem is detected. There are few script codes, the statements are very simple, and the consumption of system resources is very low. You can try it.
It seems stupid, but it is effective ~
#! /Bin/bash
# Check php-fpm server up/down
TelLog =/tmp/telphp. log
While:
Do
Sleep 15;
/Usr/bin/telnet 127.0.0.1 9000 <! > $ TelLog
Quit
!
SOK = 'cat $ TelLog | grep "Escape character" | wc-l'
If [$ SOK-eq 1]; then
Echo "php-fpm is OK"
Else
/Usr/local/webserver/php/sbin/php-fpm restart
Fi
Done
Run
Nohup/bin/sh/usr/local/shell/php_chcek.sh>/dev/null 2> & 1 &
Share happiness ~~