diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-03-12 13:17:26 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-03-12 13:17:26 +0000 |
| commit | 1a71f9e96b9ab25b8d539e0192062fb7fec487df (patch) | |
| tree | dee5ccd9723988cb8aa1821c4aea8f12fffcd2c4 /scripts | |
| parent | a86fa2c99f93e238ad5a5186ebf16f0873d82657 (diff) | |
| download | rabbitmq-server-git-1a71f9e96b9ab25b8d539e0192062fb7fec487df.tar.gz | |
Set the distribution port range to the first of these that matches:
* Not at all if it's mentioned in the config file
* $DIST_PORT if that's mentioned in the env file
* $RABBITMQ_DIST_PORT if that is set
* $RABBITMQ_NODE_PORT + 20000 if that is set
* 25672 in all other cases
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/rabbitmq-server | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server index b430eec3fa..4eb4a83ee5 100755 --- a/scripts/rabbitmq-server +++ b/scripts/rabbitmq-server @@ -29,6 +29,10 @@ DEFAULT_NODE_PORT=5672 [ "x" = "x$RABBITMQ_NODE_IP_ADDRESS" ] && [ "x" != "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_NODE_IP_ADDRESS=${DEFAULT_NODE_IP_ADDRESS} [ "x" != "x$RABBITMQ_NODE_IP_ADDRESS" ] && [ "x" = "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_NODE_PORT=${DEFAULT_NODE_PORT} +[ "x" = "x$RABBITMQ_DIST_PORT" ] && RABBITMQ_DIST_PORT=${DIST_PORT} +[ "x" = "x$RABBITMQ_DIST_PORT" ] && [ "x" = "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_DIST_PORT=$((${DEFAULT_NODE_PORT} + 20000)) +[ "x" = "x$RABBITMQ_DIST_PORT" ] && [ "x" != "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_DIST_PORT=$((${RABBITMQ_NODE_PORT} + 20000)) + [ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME} [ "x" = "x$RABBITMQ_SERVER_ERL_ARGS" ] && RABBITMQ_SERVER_ERL_ARGS=${SERVER_ERL_ARGS} [ "x" = "x$RABBITMQ_CONFIG_FILE" ] && RABBITMQ_CONFIG_FILE=${CONFIG_FILE} @@ -81,16 +85,23 @@ case "$(uname -s)" in fi esac +export RABBITMQ_CONFIG_FILE + RABBITMQ_EBIN_ROOT="${RABBITMQ_HOME}/ebin" -if ! ${ERL_DIR}erl -pa "$RABBITMQ_EBIN_ROOT" \ - -boot "${CLEAN_BOOT_FILE}" \ - -noinput \ - -hidden \ - -s rabbit_prelaunch \ - -sname rabbitmqprelaunch$$ \ - -extra "${RABBITMQ_NODENAME}"; - then - exit 1; + ${ERL_DIR}erl -pa "$RABBITMQ_EBIN_ROOT" \ + -boot "${CLEAN_BOOT_FILE}" \ + -noinput \ + -hidden \ + -s rabbit_prelaunch \ + -sname rabbitmqprelaunch$$ \ + -extra "${RABBITMQ_NODENAME}" + +PRELAUNCH_RESULT=$? +if [ ${PRELAUNCH_RESULT} == 1 ] ; then + exit 1 +elif [ ${PRELAUNCH_RESULT} == 0 ] ; then + # dist port is not mentioned in the config file, we can set it + RABBITMQ_DIST_ARG="-kernel inet_dist_listen_min ${RABBITMQ_DIST_PORT} -kernel inet_dist_listen_max ${RABBITMQ_DIST_PORT}" fi RABBITMQ_CONFIG_ARG= @@ -113,6 +124,7 @@ exec ${ERL_DIR}erl \ +W w \ ${RABBITMQ_SERVER_ERL_ARGS} \ ${RABBITMQ_LISTEN_ARG} \ + ${RABBITMQ_DIST_ARG} \ -sasl errlog_type error \ -sasl sasl_error_logger false \ -rabbit error_logger '{file,"'${RABBITMQ_LOGS}'"}' \ |
