首页 > 系统服务 > 详细

memcached监控脚本

时间:2017-03-24 19:18:31      阅读:227      评论:0      收藏:0      [点我收藏+]
#!/bin/bash

. /etc/init.d/functions
if [ `netstat -lntup| grep 11211|wc -l` -lt 1 ];then
        action "Memcached Serivce is error." /bin/false
        exit 1
fi

echo -e "del key\r\n"| nc 127.0.0.1 11211 &>/dev/null
echo -e "set key 0 0 10 \r\noldboy1234\r\n" |nc 127.0.0.1 11211 &>/dev/null
MCValues=`echo -e "get key\r\n"|nc 127.0.0.1 11211| grep oldboy1234|wc -l`

if [ $MCValues -eq 1 ];then
        action "Memcached Service Status is OK." /bin/true
else
        action "Memcached Service Status is Error." /bin/false
fi

echo -e 可以替换为 printf

memcached监控脚本

原文:http://www.cnblogs.com/vincenshen/p/6612782.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!