`
zhengdl126
  • 浏览: 2544833 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

[sh]php进程数过载后,平滑重启php

 
阅读更多

 

 

 

#vim  /usr/local/shell/php_test.sh

#!/bin/sh
#php进程数过载后,平滑重启php
r=`/usr/bin/curl -s http://127.0.0.1/test.php `
now=$(date "+%Y/%m/%d %H:%M:%S")

php_procs=`ps aux | grep php | wc -l`
if [ $r = "1" ]
then echo PHP in running.PHP Proce:$php_procs
     exit 0
else
     echo PHP error! PHP Proce:$php_procs
     echo $now PHP error! PHP Proce:$php_procs >> /usr/local/shell/PHP-errlog.txt
     kill -USR2 `cat /dev/shm/pid/php-fpm.pid`
     /usr/local/php/sbin/php-fpm -t
     exit 2
fi
 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics