summaryrefslogtreecommitdiffstats
path: root/redis-shutdown
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-02-08 12:51:06 +0100
committerRemi Collet <fedora@famillecollet.com>2016-02-08 12:51:06 +0100
commit059e1dfff0c0dac62e8aab408bb684f33d7da3a3 (patch)
tree2b74fd47999b2066f897e9e8960a912a49c86836 /redis-shutdown
parent9a91525197678fcc5e52cc601daee478d1a50372 (diff)
redis: Fix redis-shutdown to handle password-protected instances shutdown, fix #31
Diffstat (limited to 'redis-shutdown')
-rw-r--r--redis-shutdown7
1 files changed, 6 insertions, 1 deletions
diff --git a/redis-shutdown b/redis-shutdown
index f0abf29..57f21af 100644
--- a/redis-shutdown
+++ b/redis-shutdown
@@ -17,6 +17,7 @@ CONFIG_FILE="/etc/$SERVICE_NAME.conf"
# Use awk to retrieve host, port from 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`
# Just in case, use default host, port
HOST=${HOST:-127.0.0.1}
@@ -26,5 +27,9 @@ else
PORT=${PORT:-26739}
fi
+# Setup additional parameters
+# e.g password-protected redis instances
+[ -z "$PASS" ] || ADDITIONAL_PARAMS="-a $PASS"
+
# shutdown the service properly
-$REDIS_CLI -h $HOST -p $PORT shutdown
+$REDIS_CLI -h $HOST -p $PORT $ADDITIONAL_PARAMS shutdown