手机
当前位置:查字典教程网 >脚本专栏 >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脚本分享

linux下监视进程 崩溃挂掉后自动重启的shell脚本

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

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

一键配置CentOS iptables防火墙的Shell脚本分享

获取shell脚本自身所在目录的Shell脚本分享

linux自动清理日志脚本分享

监控php-fpm并自动重启服务的shell脚本

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

shell监控linux系统进程创建脚本分享

精品推荐
分类导航