zuoqz 发表于 2013-9-8 20:41:23

【军哥,再帮忙看看】502不重启php-fpm,求指点

自己本地建的502.sh上传到/root用的军哥给的:
#!/bin/bash
# author: licess
# website: http://www.lnmp.org

CheckURL="http://www.ruantui.cn/index.php"

STATUS_CODE=`curl -o /dev/null -m 10 --connect-timeout 10 -s -w %{http_code} $CheckURL`
#echo "$CheckURL Status Code:\t$STATUS_CODE"
if [ "$STATUS_CODE" = "502" ]; then
      /etc/init.d/php-fpm restart
fi


crontab日志:
Sep8 19:27:01 AY12051912132121e8189 crond: (root) CMD (/root/502.sh)
Sep8 19:28:01 AY12051912132121e8189 crond: (root) CMD (/root/502.sh)
Sep8 19:29:01 AY12051912132121e8189 crond: (root) CMD (/root/502.sh)
Sep8 19:30:01 AY12051912132121e8189 crond: (root) CMD (/usr/lib64/sa/sa1 1 1)
Sep8 19:30:01 AY12051912132121e8189 crond: (root) CMD (/root/502.sh)
Sep8 19:31:01 AY12051912132121e8189 crond: (root) CMD (/root/502.sh)
Sep8 19:32:01 AY12051912132121e8189 crond: (root) CMD (/root/502.sh)

但是显示502之后仍然不重启php-fpm,求指点!

[ 本帖最后由 zuoqz 于 2013-9-13 06:16 编辑 ]

zuoqz 发表于 2013-9-9 07:31:42

补充:直接在xshell中运行 /etc/init.d/php-fpm restart 就好使了

licess 发表于 2013-9-9 08:11:49

curl 装了没?

zuoqz 发表于 2013-9-9 08:21:52

回复 3# 的帖子

谢谢军哥:之前就已经装过了!
# /etc/init.d/php-fpm restart
Shutting down php_fpm . done
Starting php_fpmdone
# yum install curl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.grandcloud.cn
* extras: mirrors.grandcloud.cn
* updates: mirror.esocc.com
base                                                   | 1.1 kB   00:00   
extras                                                   | 2.1 kB   00:00   
updates                                                | 1.9 kB   00:00   
Excluding Packages in global exclude list
Finished
Setting up Install Process
Package curl-7.15.5-17.el5_9.x86_64 already installed and latest version
Package curl-7.15.5-17.el5_9.i386 already installed and latest version
Nothing to do

zuoqz 发表于 2013-9-9 09:25:23

版本是lnmp0.9,装了一年多了!

zuoqz 发表于 2013-9-13 06:17:24

顶上去,军哥看还需要什么日志?我传上来!

licess 发表于 2013-9-13 20:20:47

看crontab已经执行,你把脚本修改成这样
#!/bin/bash
# author: licess
# website: http://www.lnmp.org

CheckURL="http://www.ruantui.cn/index.php"
NowTime=`date`
STATUS_CODE=`curl -o /dev/null -m 10 --connect-timeout 10 -s -w %{http_code} $CheckURL`
#echo "$CheckURL Status Code:\t$STATUS_CODE"
if [ "$STATUS_CODE" = "502" ]; then
      echo "$NowTime $CheckURL Status Code:\t$STATUS_CODE" >> /root/502log.log
      /etc/init.d/php-fpm restart >> /root/502log.log
fi
这样看看/root/502log.log 里有重启的错误没
或看看php-fpm的当时重启的时间有错误没
页: [1]
查看完整版本: 【军哥,再帮忙看看】502不重启php-fpm,求指点