summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-09-21 08:27:25 +0200
committerRemi Collet <fedora@famillecollet.com>2014-09-21 08:27:25 +0200
commite6733b88c58b2919f50e995e06dfe761f8df2a09 (patch)
treec7ad314cfde888b952573c503fbb116536079341
parentd132734cbd05cba6d0c04348f931dfad41b929e3 (diff)
redis: fix/improve service management
-rw-r--r--redis-sentinel.init17
-rw-r--r--redis-sentinel.service2
-rw-r--r--redis-shutdown2
-rw-r--r--redis.init11
-rw-r--r--redis.spec6
5 files changed, 30 insertions, 8 deletions
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
diff --git a/redis-sentinel.service b/redis-sentinel.service
index ff3a117..2ec86ae 100644
--- a/redis-sentinel.service
+++ b/redis-sentinel.service
@@ -4,7 +4,7 @@ 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
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 65b67db..38d1b72 100644
--- a/redis.spec
+++ b/redis.spec
@@ -11,7 +11,7 @@
Name: redis
Version: 2.8.17
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A persistent key-value database
Group: Applications/Databases
@@ -218,6 +218,10 @@ fi
%changelog
+* Sun Sep 21 2014 Remi Collet <remi@fedoraproject.org> - 2.8.17-2
+- fix sentinel service unit file for systemd
+- also use redis-shutdown in init scripts
+
* Sat Sep 20 2014 Remi Collet <remi@fedoraproject.org> - 2.8.17-1
- Redis 2.8.17 - Release date: 19 Sep 2014
upgrade urgency: HIGH for Redis Sentinel, LOW for Redis Server.