标签:memcache 脚本 grep exp gre ror printf md5 file
#!/bin/sh
# filename: mon_mc.sh
export MemcahedIp=$1
export MemcahedPort=$2
export NcCmd="nc $MemcahedIp $MemcachedPort"
export MD5=3fe396c01f03425cb5e2da8186ev090d
USAGE(){
echo "$0 MemcachedIp MemcachedPort"
exit 3
}
[ $# -ne 2 ] && USAGE
printf "set $MD5 0 0 6\r\noldboy\r\n" | $NcCmd > /dev/null 2>&1
if [ $? -eq 0 ];then
if [ `printf "get $MD5\r\n"|$NcCmd | grep oldboy | wc -l` -eq 1 ];then
echo "Memcahed status is ok"
printf "delete $MD5\r\n"|$NcCmd >/dev/null 2>&1
exit 0
else
echo "Memcached status is error"
exit 2
fi
else
echo "cound not connect Mc server"
exit 2
fi
标签:memcache 脚本 grep exp gre ror printf md5 file
原文地址:http://www.cnblogs.com/shengy/p/7457344.html