#!/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
#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
运行
nohup /bin/sh /usr/local/shell/php_chcek.sh > /dev/null 2>&1 &
没有评论