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

vtune自动安装脚本分享

ssh expect自动登录的脚本代码

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

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

检测网站down掉后自动发信的shell脚本代码

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

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

linux自动重启tomcat脚本分享

一个下载网页图片的shell脚本

两个备份数据库的shell脚本

精品推荐
分类导航