码迷,mamicode.com
首页 > 系统相关 > 详细

Shell-Check Redis

时间:2015-01-07 11:08:01      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

REDIS=/usr/local/bin/redis-cli
REDIS_STATUS=1
CHECK_TIME=3

function check_redis_status()
{  
$REDIS PING >/dev/null 2>&1

if [ $? = 0 ];
then 
	REDIS_STATUS=1 
else 
	REDIS_STATUS=0
fi 
return $REDIS_STATUS
} 

while [ $CHECK_TIME -ne 0 ];
do 
let "CHECK_TIME -= 1" 

check_redis_status 

if [ $REDIS_STATUS = 1 ]; 
then 
	REDIS_STATUS=1
	exit 0
fi 

if [ $REDIS_STATUS -eq 0 ] && [ $CHECK_TIME -eq 0 ];
then 
	/etc/init.d/keepalived stop 
	exit 1 
fi 
sleep 1

done

Shell-Check Redis

标签:

原文地址:http://blog.csdn.net/jxzkin/article/details/42487101

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!