From e6733b88c58b2919f50e995e06dfe761f8df2a09 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 21 Sep 2014 08:27:25 +0200 Subject: redis: fix/improve service management --- redis-sentinel.init | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'redis-sentinel.init') diff --git a/redis-sentinel.init b/redis-sentinel.init index 115f65b..e9d3c34 100644 --- a/redis-sentinel.init +++ b/redis-sentinel.init @@ -10,18 +10,19 @@ name="redis-sentinel" exec="/usr/bin/$name" +shut="/usr/bin/redis-shutdown" pidfile="/var/run/redis/sentinel.pid" -REDIS_CONFIG="/etc/redis-sentinel.conf" +SENTINEL_CONFIG="/etc/redis-sentinel.conf" [ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel lockfile=/var/lock/subsys/redis start() { - [ -f $REDIS_CONFIG ] || exit 6 + [ -f $SENTINEL_CONFIG ] || exit 6 [ -x $exec ] || exit 5 echo -n $"Starting $name: " - daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile" + daemon --user ${REDIS_USER-redis} "$exec $SENTINEL_CONFIG --daemonize yes --pidfile $pidfile" retval=$? echo [ $retval -eq 0 ] && touch $lockfile @@ -30,8 +31,16 @@ start() { stop() { echo -n $"Stopping $name: " - killproc -p $pidfile $name + [ -x $shut ] && $shut $name retval=$? + if [ -f $pidfile ] + then + # shutdown haven't work, try old way + killproc -p $pidfile $name + retval=$? + else + success "$name shutdown" + fi echo [ $retval -eq 0 ] && rm -f $lockfile return $retval -- cgit