f312977bd1
- fix redis-sentinel service unit file for systemd - fix redis-shutdown for sentinel - also use redis-shutdown in init scripts
28 lines
608 B
Bash
28 lines
608 B
Bash
#!/bin/bash
|
|
#
|
|
# Wrapper to close properly redis and sentinel
|
|
test x"$REDIS_DEBUG" != x && set -x
|
|
|
|
REDIS_CLI=/usr/bin/redis-cli
|
|
|
|
# Retrieve service name
|
|
SERVICE_NAME="$1"
|
|
if [ -z "$SERVICE_NAME" ]; then
|
|
SERVICE_NAME=redis
|
|
fi
|
|
|
|
# Get the proper config file based on service name
|
|
CONFIG_FILE="/etc/$SERVICE_NAME.conf"
|
|
|
|
# Use awk to retrieve port from config file
|
|
PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE`
|
|
|
|
# Just in case, use default port
|
|
if [ "$SERVICE_NAME" = redis ]; then
|
|
PORT=${PORT:-6379}
|
|
else
|
|
PORT=${PORT:-26739}
|
|
fi
|
|
|
|
# shutdown the service properly
|
|
$REDIS_CLI -p $PORT shutdown |