summaryrefslogtreecommitdiffstats
path: root/redis-shutdown
diff options
context:
space:
mode:
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 57f21af..53b9f09 100644
--- a/redis-shutdown
+++ b/redis-shutdown
@@ -18,6 +18,7 @@ CONFIG_FILE="/etc/$SERVICE_NAME.conf"
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