diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-04-03 16:27:04 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-04-03 17:27:40 +0200 |
| commit | 797ee7fa0794f60d96fa7c5bf780853b78de2ef3 (patch) | |
| tree | c590abf7622d414d94768e4d7b9a348277db8366 /scripts/rabbitmq-env | |
| parent | c5a3e04772d281386cb7a90e4bf2c8a15ed43000 (diff) | |
| download | rabbitmq-server-git-797ee7fa0794f60d96fa7c5bf780853b78de2ef3.tar.gz | |
Init scripts: Honor RABBITMQ_LOG_BASE for {startup,shutdown}_* location
Before this change, they were written to /var/log/rabbitmq, no matter
the value of RABBITMQ_LOG_BASE.
In rabbitmq-env, allow the caller to set RABBITMQ_SCRIPTS_DIR to the
directory where rabbitmq-env and rabbitmq-default are located.
In both Fedora and Debian rabbitmq-server.init and
rabbitmq-script-wrapper, load rabbitmq-env and use RABBITMQ_LOG_BASE.
The default value is /var/log/rabbitmq, so the default behaviour remains
the same.
In Debian's rabbitmq-script-wrapper version, use RABBITMQ_LOG_BASE
instead of the hard-coded /var/log/rabbitmq.
Fixes #88.
Diffstat (limited to 'scripts/rabbitmq-env')
| -rwxr-xr-x | scripts/rabbitmq-env | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env index 8a1b4d6510..7eb5545fd1 100755 --- a/scripts/rabbitmq-env +++ b/scripts/rabbitmq-env @@ -15,33 +15,36 @@ ## Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. ## -# We set +e here since since our test for "readlink -f" below needs to -# be able to fail. -set +e -# Determine where this script is really located (if this script is -# invoked from another script, this is the location of the caller) -SCRIPT_PATH="$0" -while [ -h "$SCRIPT_PATH" ] ; do - # Determine if readlink -f is supported at all. TODO clean this up. - FULL_PATH=`readlink -f $SCRIPT_PATH 2>/dev/null` - if [ "$?" != "0" ]; then - REL_PATH=`readlink $SCRIPT_PATH` - if expr "$REL_PATH" : '/.*' > /dev/null; then - SCRIPT_PATH="$REL_PATH" - else - SCRIPT_PATH="`dirname "$SCRIPT_PATH"`/$REL_PATH" - fi - else - SCRIPT_PATH=$FULL_PATH - fi -done -set -e - -SCRIPT_DIR=`dirname $SCRIPT_PATH` -RABBITMQ_HOME="${SCRIPT_DIR}/.." +if [ -z "$RABBITMQ_SCRIPTS_DIR" ]; then + # We set +e here since since our test for "readlink -f" below needs to + # be able to fail. + set +e + # Determine where this script is really located (if this script is + # invoked from another script, this is the location of the caller) + SCRIPT_PATH="$0" + while [ -h "$SCRIPT_PATH" ] ; do + # Determine if readlink -f is supported at all. TODO clean this up. + FULL_PATH=`readlink -f $SCRIPT_PATH 2>/dev/null` + if [ "$?" != "0" ]; then + REL_PATH=`readlink $SCRIPT_PATH` + if expr "$REL_PATH" : '/.*' > /dev/null; then + SCRIPT_PATH="$REL_PATH" + else + SCRIPT_PATH="`dirname "$SCRIPT_PATH"`/$REL_PATH" + fi + else + SCRIPT_PATH=$FULL_PATH + fi + done + set -e + + RABBITMQ_SCRIPTS_DIR=`dirname $SCRIPT_PATH` +fi + +RABBITMQ_HOME="${RABBITMQ_SCRIPTS_DIR}/.." ## Set defaults -. ${SCRIPT_DIR}/rabbitmq-defaults +. ${RABBITMQ_SCRIPTS_DIR}/rabbitmq-defaults ## Common defaults SERVER_ERL_ARGS="+K true +A30 +P 1048576 \ |
