#!/bin/bash
TIME=`date +"%Y-%m-%d_%H:%M:%S"`
#if [ $# -lt 1 ]; then
# echo "usage: ./start_redis port"
# exit 1;
#else
echo -e "\n"[${TIME}]" Run Scheduler\n " >> /srv/redis/log/start_redis.log
#case ${1} in
#0)
pid_sentinel=`ps -ef | grep '6381' | grep 'redis-sentinel' | grep -v 'grep' | awk '{print $2}'`
if [ -z $pid_sentinel ]; then
echo -e [${TIME}]" port 6381 " >> /srv/redis/log/start_redis.log
/srv/redis/bin/redis-sentinel /srv/redis/sentinel.conf
fi
sleep 5
#;;
#1)
pid_master=`ps -ef | grep '6379' | grep 'redis-server' | grep -v 'grep' | awk '{print $2}'`
if [ -z $pid_master ]; then
echo -e [${TIME}]" port 6379 " >> /srv/redis/log/start_redis.log
/srv/redis/bin/redis-server /srv/redis/redis.conf
fi
sleep 5
#;;
#2)
pid_slave=`ps -ef | grep '6380' | grep 'redis-server' | grep -v 'grep' | awk '{print $2}'`
if [ -z $pid_slave ]; then
echo -e [${TIME}]" port 6380 " >> /srv/redis/log/start_redis.log
/srv/redis/bin/redis-server /srv/redis/redis_slave.conf
fi
#;;
#esac
#fi
'Redis' 카테고리의 다른 글
redis, centOS, ruby & gem 설치 및 설정 (0) | 2018.01.20 |
---|