手机
当前位置:查字典教程网 >脚本专栏 >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下监视进程 崩溃挂掉后自动重启的shell脚本

监控网站是否可以正常打开的Shell脚本分享

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

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

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

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

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

shell监控脚本 准备工作分享

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

精品推荐
分类导航