一个简单的脚本,用来监控502的,如果遇到502,自动重启PHP进程。适用于LNMP环境。
以下文件,存放于 /root 或其它目录:
#!/bin/bash
MY_URL="http://www.vpsmm.com/"
RESULT=`curl -I $MY_URL|grep "HTTP/1.1 502"`
if [ -n "$RESULT" ]; then
/etc/init.d/php-fpm restart
fi
给予可执行权限:
chmod +x /root/php.sh
通过 crontab 设置自动运行:
crontab -e
* * * * * /root/php.sh
Hey I am so glad I found your web site, I really
found you by error, while I was researching on Google for something else,
Nonetheless I am here now and would just like to say thanks for a incredible post and a all round interesting blog (I also love the theme/design), I don’t have time to look
over it all at the minute but I have bookmarked it and also included
your RSS feeds, so when I have time I will be back to read
a great deal more, Please do keep up the great b.