#!/bin/bash ## 2017-03-04 ## http://www.aqzt.com ## email: ppabc@qq.com ## robert yu ## centos 6 ## 部署redis sentinel脚本 ## Host=$2 case "$1" in start) ### start /opt/redis/bin/redis-server /opt/redis/redis.conf & /opt/redis/bin/redis-server /opt/redis/sentinel.conf --sentinel & ### start ;; stop) ### stop ps -ef | grep redis | grep sentinel | grep -v grep | grep -v sh | awk '{print $2}' | xargs kill ps -ef | grep redis | grep server | grep -v grep | grep -v sh | awk '{print $2}' | xargs kill echo ok ### stop ;; restart) echo restart ;; master) ###master cat >/opt/redis/redis.conf</opt/redis/redis.conf</opt/redis/sentinel.conf<&2 exit 3 ;; esac