From 4f1d5f156de46eb4dd7883bdaf512f6fc6e4a4d4 Mon Sep 17 00:00:00 2001 From: Haikel Guemar Date: Fri, 23 Jun 2017 15:02:11 +0200 Subject: [PATCH] Upstream 3.2.9 Add RuntimeDirectory=redis to systemd unit file (RHBZ #1454700) Mark rundir as %ghost since it may disappear (tmpfs - #1454700) Fix a shutdown failure with Unix domain sockets (RHBZ #1444988) Patch contributed by Nathan Scott --- redis-shutdown | 13 +++++++++---- redis.service | 2 ++ redis.spec | 10 ++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/redis-shutdown b/redis-shutdown index 405083f..53b9f09 100644 --- a/redis-shutdown +++ b/redis-shutdown @@ -15,9 +15,10 @@ fi CONFIG_FILE="/etc/$SERVICE_NAME.conf" # Use awk to retrieve host, port from config file -HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE` -PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE` -PASS=`awk '/^[[:blank:]]*requirepass/ { print $2 }' $CONFIG_FILE` +HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE | tail -n1` +PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE | tail -n1` +PASS=`awk '/^[[:blank:]]*requirepass/ { print $2 }' $CONFIG_FILE | tail -n1` +SOCK=`awk '/^[[:blank:]]*unixsocket\s/ { print $2 }' $CONFIG_FILE | tail -n1` # Just in case, use default host, port HOST=${HOST:-127.0.0.1} @@ -32,4 +33,8 @@ fi [ -z "$PASS" ] || ADDITIONAL_PARAMS="-a $PASS" # shutdown the service properly -$REDIS_CLI -h $HOST -p $PORT $ADDITIONAL_PARAMS shutdown +if [ -e "$SOCK" ] ; then + $REDIS_CLI -s $SOCK $ADDITIONAL_PARAMS shutdown +else + $REDIS_CLI -h $HOST -p $PORT $ADDITIONAL_PARAMS shutdown +fi diff --git a/redis.service b/redis.service index 0e4eed0..e01dbfe 100644 --- a/redis.service +++ b/redis.service @@ -7,6 +7,8 @@ ExecStart=/usr/bin/redis-server /etc/redis.conf --daemonize no ExecStop=/usr/libexec/redis-shutdown User=redis Group=redis +RuntimeDirectory=redis +RuntimeDirectoryMode=0750 [Install] WantedBy=multi-user.target diff --git a/redis.spec b/redis.spec index 6e497b5..e6f4bbd 100644 --- a/redis.spec +++ b/redis.spec @@ -11,7 +11,7 @@ %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: redis -Version: 3.2.8 +Version: 3.2.9 Release: 1%{?dist} Summary: A persistent key-value database License: BSD @@ -235,7 +235,7 @@ fi %attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}-sentinel.conf %dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name} %dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name} -%dir %attr(0750, redis, redis) %{_localstatedir}/run/%{name} +%dir %attr(0750, redis, redis) %ghost %{_localstatedir}/run/%{name} %{_bindir}/%{name}-* %{_libexecdir}/%{name}-* %{_mandir}/man1/%{name}* @@ -256,6 +256,12 @@ fi %changelog +* Mon May 29 2017 Nathan Scott - 3.2.9-1 +- Upstream 3.2.9 +- Add RuntimeDirectory=redis to systemd unit file (RHBZ #1454700) +- Mark rundir as %ghost since it may disappear (tmpfs - #1454700) +- Fix a shutdown failure with Unix domain sockets (RHBZ #1444988) + * Mon Feb 20 2017 Haïkel Guémar - 3.2.8-1 - Upstream 3.2.8 - bugfix for #3796 (MIGRATE could cause server crash after socket error)