#!/bin/sh
set -x
if [ -e /var/lock/subsys/502 ]
then
killall -9 curl 2>/dev/null
killall -9 php-fpm 2>/dev/null
/usr/local/php5/sbin/php-fpm >/dev/null
echo "[ `date +'%h %d %T'` ] PHP-FPM died with no response, all processes restarted">>/tmp/pfpm.txt
else
touch /var/lock/subsys/502
if [ `curl --connect-timeout 5 -I http://eds.test.com/monitorphp.php 2>/dev/null | grep '502 Bad Gateway' -c` != '0' ]
then
killall -9 php-fpm 2>/dev/null
/usr/local/php5/sbin/php-fpm >/dev/null
echo "[ `date +'%h %d %T'` ] PHP-FPM died with 502 bad gateway, all processes restarted">>/tmp/pfpm.txt
fi
rm -f /var/lock/subsys/502
fi
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。