- Upstream 2.8.17

- fix redis-sentinel service unit file for systemd
- fix redis-shutdown for sentinel
- also use redis-shutdown in init scripts
This commit is contained in:
Remi Collet 2014-09-21 08:25:11 +02:00
parent e4f5128ae6
commit f312977bd1
5 changed files with 39 additions and 19 deletions

View File

@ -8,11 +8,11 @@
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
NAME="redis-sentinel" name="redis-sentinel"
EXEC="/usr/bin/$NAME" exec="/usr/bin/$name"
shut="/usr/bin/redis-shutdown"
pidfile="/var/run/redis/sentinel.pid"
SENTINEL_CONFIG="/etc/redis-sentinel.conf" SENTINEL_CONFIG="/etc/redis-sentinel.conf"
RUNDIR="/var/run/redis"
PIDFILE="$RUNDIR/redis-sentinel.pid"
[ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel [ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel
@ -20,13 +20,9 @@ lockfile=/var/lock/subsys/redis
start() { start() {
[ -f $SENTINEL_CONFIG ] || exit 6 [ -f $SENTINEL_CONFIG ] || exit 6
[ -x $EXEC ] || exit 5 [ -x $exec ] || exit 5
echo -n $"Starting $NAME: " echo -n $"Starting $name: "
mkdir -p $RUNDIR daemon --user ${REDIS_USER-redis} "$exec $SENTINEL_CONFIG --daemonize yes --pidfile $pidfile"
touch $PIDFILE
chown redis:redis $RUNDIR $PIDFILE
chmod 750 $RUNDIR
daemon --user ${REDIS_USER-redis} --pidfile=$PIDFILE "$EXEC $SENTINEL_CONFIG"
retval=$? retval=$?
echo echo
[ $retval -eq 0 ] && touch $lockfile [ $retval -eq 0 ] && touch $lockfile
@ -34,9 +30,17 @@ start() {
} }
stop() { stop() {
echo -n $"Stopping $NAME: " echo -n $"Stopping $name: "
killproc -p $PIDFILE $NAME [ -x $shut ] && $shut $name
retval=$? retval=$?
if [ -f $pidfile ]
then
# shutdown haven't work, try old way
killproc -p $pidfile $name
retval=$?
else
success "$name shutdown"
fi
echo echo
[ $retval -eq 0 ] && rm -f $lockfile [ $retval -eq 0 ] && rm -f $lockfile
return $retval return $retval
@ -52,7 +56,7 @@ reload() {
} }
rh_status() { rh_status() {
status -p $PIDFILE $NAME status -p $pidfile $name
} }
rh_status_q() { rh_status_q() {

View File

@ -4,9 +4,10 @@ After=network.target
[Service] [Service]
ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --daemonize no 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 User=redis
Group=redis Group=redis
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -6,7 +6,7 @@ test x"$REDIS_DEBUG" != x && set -x
REDIS_CLI=/usr/bin/redis-cli REDIS_CLI=/usr/bin/redis-cli
# Retrieve service name # Retrieve service name
SERVICE_NAME="$2" SERVICE_NAME="$1"
if [ -z "$SERVICE_NAME" ]; then if [ -z "$SERVICE_NAME" ]; then
SERVICE_NAME=redis SERVICE_NAME=redis
fi fi

View File

@ -10,6 +10,7 @@
name="redis-server" name="redis-server"
exec="/usr/bin/$name" exec="/usr/bin/$name"
shut="/usr/bin/redis-shutdown"
pidfile="/var/run/redis/redis.pid" pidfile="/var/run/redis/redis.pid"
REDIS_CONFIG="/etc/redis.conf" REDIS_CONFIG="/etc/redis.conf"
@ -30,8 +31,16 @@ start() {
stop() { stop() {
echo -n $"Stopping $name: " echo -n $"Stopping $name: "
killproc -p $pidfile $name [ -x $shut ] && $shut
retval=$? retval=$?
if [ -f $pidfile ]
then
# shutdown haven't work, try old way
killproc -p $pidfile $name
retval=$?
else
success "$name shutdown"
fi
echo echo
[ $retval -eq 0 ] && rm -f $lockfile [ $retval -eq 0 ] && rm -f $lockfile
return $retval return $retval

View File

@ -18,8 +18,8 @@
%global with_tests %{?_with_tests:1}%{!?_with_tests:0} %global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: redis Name: redis
Version: 2.8.15 Version: 2.8.17
Release: 2%{?dist} Release: 1%{?dist}
Summary: A persistent key-value database Summary: A persistent key-value database
License: BSD License: BSD
URL: http://redis.io URL: http://redis.io
@ -263,6 +263,12 @@ fi
%endif %endif
%changelog %changelog
* Sun Sep 20 2014 Remi Collet <remi@fedoraproject.org> - 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 <hguemar@fedoraproject.org> - 2.8.15-2 * Wed Sep 17 2014 Haïkel Guémar <hguemar@fedoraproject.org> - 2.8.15-2
- Minor fix to redis-shutdown (from Remi Collet) - Minor fix to redis-shutdown (from Remi Collet)