手机
当前位置:查字典教程网 >脚本专栏 >linuxshell >一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
摘要:复制代码代码如下:#!/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

【一个监控Squid运行进程数并自动重启的简洁Shell脚本分享】相关文章:

一个简单的防CC攻击Shell脚本分享

自动重启服务的shell脚本代码

用于检测进程的shell脚本代码小结

shell监控脚本 准备工作分享

监控服务器swap并重启php的Shell脚本

vtune自动安装脚本分享

vtune自动化安装脚本

3个备份系统文件并邮件发送的Shell脚本分享

一个监控LINUX目录和文件变化的Shell脚本分享

智能监测自动重启Apache服务器的Shell脚本

精品推荐
分类导航