欢迎来到站长天空!

其它服务器

当前位置: 主页 > 服务器 > 其它服务器

一个监控Squid运行进程数并自动重启的简洁Shell脚本分享

时间:2025-12-31 06:30:02|栏目:其它服务器|点击:

复制代码 代码如下:
#!/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

上一篇:Linux Shell的一些使用小技巧收集

栏    目:其它服务器

下一篇:CentOS下mysql定时备份Shell脚本分享

本文标题:一个监控Squid运行进程数并自动重启的简洁Shell脚本分享

本文地址:https://zz.feitang.co/server/34741.html

广告投放 | 联系我们 | 版权申明

申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:257218569 | 邮箱:257218569@qq.com

Copyright © 2018-2025 站长天空 版权所有 Powered by EyouCms冀ICP备14023439号