#!/bin/bash . /etc/init.d/functions
if [ `netstat -lntup| grep |wc -l` -lt ];then
action "Memcached Serivce is error." /bin/false
exit
fi echo -e "del key\r\n"| nc 127.0.0.1 &>/dev/null
echo -e "set key 0 0 10 \r\noldboy1234\r\n" |nc 127.0.0.1 &>/dev/null
MCValues=`echo -e "get key\r\n"|nc 127.0.0.1 | grep oldboy1234|wc -l` if [ $MCValues -eq ];then
action "Memcached Service Status is OK." /bin/true
else
action "Memcached Service Status is Error." /bin/false
fi
echo -e 可以替换为 printf