Skip to content

Commit 0f237da

Browse files
author
Matthew Sackman
committed
merging from bug 21449
2 parents 0271621 + c3cc82c commit 0f237da

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

scripts/rabbitmqctl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
## Contributor(s): ______________________________________.
3131
##
3232

33+
NODENAME=rabbit
34+
3335
. `dirname $0`/rabbitmq-env
3436

37+
[ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME}
3538
[ "x" = "x$RABBITMQ_CTL_ERL_ARGS" ] && RABBITMQ_CTL_ERL_ARGS=${CTL_ERL_ARGS}
3639

3740
exec erl \
@@ -41,4 +44,6 @@ exec erl \
4144
${RABBITMQ_CTL_ERL_ARGS} \
4245
-sname rabbitmqctl$$ \
4346
-s rabbit_control \
47+
-nodename $RABBITMQ_NODENAME \
4448
-extra "$@"
49+

scripts/rabbitmqctl.bat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ REM
3030
REM Contributor(s): ______________________________________.
3131
REM
3232

33+
if "%RABBITMQ_NODENAME%"=="" (
34+
set RABBITMQ_NODENAME=rabbit
35+
)
36+
3337
if not exist "%ERLANG_HOME%\bin\erl.exe" (
3438
echo.
3539
echo ******************************
@@ -42,4 +46,4 @@ if not exist "%ERLANG_HOME%\bin\erl.exe" (
4246
exit /B
4347
)
4448

45-
"%ERLANG_HOME%\bin\erl.exe" -pa "%~dp0..\ebin" -noinput -hidden %RABBITMQ_CTL_ERL_ARGS% -sname rabbitmqctl -s rabbit_control -extra %*
49+
"%ERLANG_HOME%\bin\erl.exe" -pa "%~dp0..\ebin" -noinput -hidden %RABBITMQ_CTL_ERL_ARGS% -sname rabbitmqctl -s rabbit_control -nodename %RABBITMQ_NODENAME% -extra %*

src/rabbit_control.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
%%----------------------------------------------------------------------------
5353

5454
start() ->
55+
{ok, [[NodeNameStr|_]|_]} = init:get_argument(nodename),
56+
NodeName = list_to_atom(NodeNameStr),
5557
FullCommand = init:get_plain_arguments(),
5658
#params{quiet = Quiet, node = Node, command = Command, args = Args} =
5759
parse_args(FullCommand, #params{quiet = false,
58-
node = rabbit_misc:localnode(rabbit)}),
60+
node = rabbit_misc:localnode(NodeName)}),
5961
Inform = case Quiet of
6062
true -> fun(_Format, _Args1) -> ok end;
6163
false -> fun(Format, Args1) ->

0 commit comments

Comments
 (0)