502 Bad Gateway 自动重启脚本@LNMP

3,133 views次阅读
没有评论

一个简单的脚本,用来监控502的,如果遇到502,自动重启PHP进程。适用于LNMP环境。

以下文件,存放于 /root 或其它目录:

  1. #!/bin/bash
  2. MY_URL="https://www.hopolcn.com/"
  3. RESULT=`curl -I $MY_URL|grep "HTTP/1.1 502"`
  4. if [ -n "$RESULT" ]; then
  5.         /etc/init.d/php-fpm restart
  6. fi

给予可执行权限:

  1. chmod +x /root/php.sh

 

通过 crontab 设置自动运行:

 

  1. crontab -e
  2. * * * * * /root/php.sh

 

正文完
 0
HopoL
版权声明:本站原创文章,由 HopoL 于2015-10-28发表,共计294字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)

HopoL's Blog

文章搜索
最新评论
阿龙 阿龙 谢谢大佬分享
MickeyDee MickeyDee Cancell that, figured it out and it works, Much appriciated .
MickeyDee MickeyDee Hi Thanks for sharing, please clarify, do you mean Rename the folder "unraider-7.2.0" to unraider and copy it to the config . Thanks
lzdwudi lzdwudi 我也想试试 但我目前的版本是6.12.13 我不敢做大的动作
wice222 wice222 archive is demaged
tstUser01 tstUser01 Thanks for sharing!
saisu saisu how to install from scratch for noobs like me please :D What is GUID ??
Adrian Adrian How update works? Should we rename unraider file, do the update and rename back? from 7.2.0 to 7.2.1
步兵 步兵 哈喽 想请问一下文件是从老毛子网站下载的吗 因为怕有挖矿的后门 所以想了解确认一下 感谢
hpapagaj hpapagaj Thank you.