while sleep 30
do
squidnum=`ps -ef|grep squid|grep -v grep|wc -l`
#httpnum=`netstat -an|grep 0.0.0.0:80|grep -v grep|wc -l` #80状态
if [ $squidnum != 3 ] ; then
/etc/rc3.duid start
adddate=`date +%y-%m-%d`" "`date +%h:%m:%s`
echo "$adddate squid started!" >> /home/resquid.log
fi
#超过5000个http请求就重启squid服务
httpnum=`netstat -an|grep 80|grep -v grep|wc -l`
if [ $httpnum -gt 5000 ] ; then
/etc/rc3.duid restart
adddate=`date +%y-%m-%d`" "`date +%h:%m:%s`
echo "$adddate http out 5000 squid started!" >> /home/resquid.log
fi
done
如对本文有疑问, 点击进行留言回复!!
网友评论