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

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

linux自动重启tomcat脚本分享

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

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

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

25个好用的Shell脚本常用命令分享

vtune自动化安装脚本

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

实现释放CentOS系统内存的Shell脚本分享

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

精品推荐
分类导航