diff --git a/redis-sentinel.init b/redis-sentinel.init index dd2b7ec..e9d3c34 100644 --- a/redis-sentinel.init +++ b/redis-sentinel.init @@ -8,11 +8,11 @@ # Source function library. . /etc/rc.d/init.d/functions -NAME="redis-sentinel" -EXEC="/usr/bin/$NAME" +name="redis-sentinel" +exec="/usr/bin/$name" +shut="/usr/bin/redis-shutdown" +pidfile="/var/run/redis/sentinel.pid" SENTINEL_CONFIG="/etc/redis-sentinel.conf" -RUNDIR="/var/run/redis" -PIDFILE="$RUNDIR/redis-sentinel.pid" [ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel @@ -20,13 +20,9 @@ lockfile=/var/lock/subsys/redis start() { [ -f $SENTINEL_CONFIG ] || exit 6 - [ -x $EXEC ] || exit 5 - echo -n $"Starting $NAME: " - mkdir -p $RUNDIR - touch $PIDFILE - chown redis:redis $RUNDIR $PIDFILE - chmod 750 $RUNDIR - daemon --user ${REDIS_USER-redis} --pidfile=$PIDFILE "$EXEC $SENTINEL_CONFIG" + [ -x $exec ] || exit 5 + echo -n $"Starting $name: " + daemon --user ${REDIS_USER-redis} "$exec $SENTINEL_CONFIG --daemonize yes --pidfile $pidfile" retval=$? echo [ $retval -eq 0 ] && touch $lockfile @@ -34,9 +30,17 @@ start() { } stop() { - echo -n $"Stopping $NAME: " - killproc -p $PIDFILE $NAME + echo -n $"Stopping $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 @@ -52,7 +56,7 @@ reload() { } rh_status() { - status -p $PIDFILE $NAME + status -p $pidfile $name } rh_status_q() { diff --git a/redis-sentinel.service b/redis-sentinel.service index d5f7dc0..2ec86ae 100644 --- a/redis-sentinel.service +++ b/redis-sentinel.service @@ -4,9 +4,10 @@ After=network.target [Service] ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --daemonize no -ExecStop=/usr/bin/redis-shutdown sentinel +ExecStop=/usr/bin/redis-shutdown redis-sentinel User=redis Group=redis [Install] WantedBy=multi-user.target + diff --git a/redis-shutdown b/redis-shutdown index fdb14ea..1b0622f 100644 --- a/redis-shutdown +++ b/redis-shutdown @@ -6,7 +6,7 @@ test x"$REDIS_DEBUG" != x && set -x REDIS_CLI=/usr/bin/redis-cli # Retrieve service name -SERVICE_NAME="$2" +SERVICE_NAME="$1" if [ -z "$SERVICE_NAME" ]; then SERVICE_NAME=redis fi diff --git a/redis.init b/redis.init index 0479769..96385eb 100644 --- a/redis.init +++ b/redis.init @@ -10,6 +10,7 @@ name="redis-server" exec="/usr/bin/$name" +shut="/usr/bin/redis-shutdown" pidfile="/var/run/redis/redis.pid" REDIS_CONFIG="/etc/redis.conf" @@ -30,8 +31,16 @@ start() { stop() { echo -n $"Stopping $name: " - killproc -p $pidfile $name + [ -x $shut ] && $shut 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 diff --git a/redis.spec b/redis.spec index 24b6a9a..7161375 100644 --- a/redis.spec +++ b/redis.spec @@ -18,8 +18,8 @@ %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: redis -Version: 2.8.15 -Release: 2%{?dist} +Version: 2.8.17 +Release: 1%{?dist} Summary: A persistent key-value database License: BSD URL: http://redis.io @@ -263,6 +263,12 @@ fi %endif %changelog +* Sun Sep 20 2014 Remi Collet - 2.8.17-1 +- Upstream 2.8.17 +- fix redis-sentinel service unit file for systemd +- fix redis-shutdown for sentinel +- also use redis-shutdown in init scripts + * Wed Sep 17 2014 Haïkel Guémar - 2.8.15-2 - Minor fix to redis-shutdown (from Remi Collet)