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
您可能感兴趣的文章:
- shell脚本实现监控shell脚本的执行流程及变量的值
- Shell脚本实现Linux系统和进程资源监控
- Shell脚本实现监控MySQL主从同步
- Shell脚本实现监控iptables运行状态
- Shell脚本实现监控rsync数据是否传输完
- Shell脚本实现监控kingate并自动启动
- Shell脚本实现监控iptables规则是否被修改
- Shell脚本实现memcache缓存命中率监控
- Shell脚本编写Nagios插件监控程序资源占用
- Linux服务器硬件运行状态及故障邮件提醒的监控脚本分享
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)