一个监控Squid运行进程数并自动重启的简洁Shell脚本分享_linuxshell教程-查字典教程网
一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:#!/bin/shwhilesleep30doSquidNum=`ps-ef|grepsquid|grep-vgrep|w...

复制代码 代码如下:

#!/bin/sh

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

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新linuxshell学习
    热门linuxshell学习
    脚本专栏子分类