Fix redis-shutdown to handle password-protected instances
This commit is contained in:
parent
c4cdeb229e
commit
ffd00fb400
@ -17,6 +17,7 @@ CONFIG_FILE="/etc/$SERVICE_NAME.conf"
|
|||||||
# Use awk to retrieve host, port from config file
|
# Use awk to retrieve host, port from config file
|
||||||
HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE`
|
HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE`
|
||||||
PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE`
|
PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE`
|
||||||
|
PASS=`awk '/^[[:blank:]]*requirepass/ { print $2 }' $CONFIG_FILE`
|
||||||
|
|
||||||
# Just in case, use default host, port
|
# Just in case, use default host, port
|
||||||
HOST=${HOST:-127.0.0.1}
|
HOST=${HOST:-127.0.0.1}
|
||||||
@ -26,5 +27,9 @@ else
|
|||||||
PORT=${PORT:-26739}
|
PORT=${PORT:-26739}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setup additional parameters
|
||||||
|
# e.g password-protected redis instances
|
||||||
|
[ -z "$PASS" ] || ADDITIONAL_PARAMS="-a $PASS"
|
||||||
|
|
||||||
# shutdown the service properly
|
# shutdown the service properly
|
||||||
$REDIS_CLI -h $HOST -p $PORT shutdown
|
$REDIS_CLI -h $HOST -p $PORT $ADDITIONAL_PARAMS shutdown
|
||||||
|
Loading…
Reference in New Issue
Block a user