傅令江的光影色彩世界
监控memcache服务端口
2014-7-10 令狐江

监控memechache服务端口,如果不存在就重启memcache服务

[root@AY131218143326567e8eZ fu]# mkdir /etc/fu/
[root@AY131218143326567e8eZ fu]# cd /etc/fu/
[root@AY131218143326567e8eZ fu]# vi  11211.sh

 

#!/bin/bash
testing11211=`(netstat -lpn | grep 11211 )`
#while [ "$testing11211" == "" ]
#do
if [ "$testing11211" == "" ]
then
#service memcached restart
/sbin/service memcached restart > /dev/null 2>&1
echo "memcached  restart at `date +%y-%m-%d\ %H:%M:%S`" >> /etc/fu/times.txt
fi
#done

 

 


[root@AY131218143326567e8eZ fu]# chmod 755  11211.sh
[root@AY131218143326567e8eZ fu]#crontab -e

 

* * * * * /bin/sh /etc/fu/11211.sh

 

[root@AY131218143326567e8eZ fu]#service crond restart

每分钟运行一次监控的计划任务

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容