监控Squid运行的简洁脚本
分类:shell编程 阅读:50034 次
#!/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
热门推荐
- shell脚本检测监控mysql的CPU占用率
- CentOS系统安全设置Shell脚本
- CentOS防CC攻击shell脚本
- CentOS 查后门程序的shell
- CentOS下备份文件小脚本
- centos系统初始化脚本
- shell脚本解决克隆vmware后有网卡冲突的问题
- shell脚本添加用户删除用户删除文件的脚本实现
- shell脚本编程(合并排序)
- shell脚本编程(快速排序)
- shell脚本(严格的终端格式控制,美丽的输出字体颜色)
- shell面试题汇集
- shell脚本练习题
- 增量备份系统文件的shell脚本
- mysql数据库备份脚本
- CentOS一键配置rsync服务器shell脚本
- 个强大的分析网络的shell脚本
- 运维shell命令
- centos定时释放内存脚本
- 常用到的iptables脚本