summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Majkowski <majek@lshift.net>2009-09-04 17:45:48 +0100
committerMarek Majkowski <majek@lshift.net>2009-09-04 17:45:48 +0100
commit5fc501b3bc5ee8873d85410542a6b01bb2f27bdb (patch)
tree5cd8b276a435ee266416edd07c59a41e6fa2d824
parent672c802fbdc3127e4152c8698881bc88df6aac0c (diff)
downloadrabbitmq-server-5fc501b3bc5ee8873d85410542a6b01bb2f27bdb.tar.gz
rabbitmqctl now accepts -nodename
-rwxr-xr-xscripts/rabbitmqctl5
-rwxr-xr-xscripts/rabbitmqctl.bat6
-rw-r--r--src/rabbit_control.erl4
3 files changed, 13 insertions, 2 deletions
diff --git a/scripts/rabbitmqctl b/scripts/rabbitmqctl
index 9c45e73d..a332afc6 100755
--- a/scripts/rabbitmqctl
+++ b/scripts/rabbitmqctl
@@ -30,8 +30,11 @@
## Contributor(s): ______________________________________.
##
+NODENAME=rabbit
+
. `dirname $0`/rabbitmq-env
+[ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME}
[ "x" = "x$RABBITMQ_CTL_ERL_ARGS" ] && RABBITMQ_CTL_ERL_ARGS=${CTL_ERL_ARGS}
exec erl \
@@ -41,4 +44,6 @@ exec erl \
${RABBITMQ_CTL_ERL_ARGS} \
-sname rabbitmqctl$$ \
-s rabbit_control \
+ -nodename $RABBITMQ_NODENAME \
-extra "$@"
+
diff --git a/scripts/rabbitmqctl.bat b/scripts/rabbitmqctl.bat
index 5111724f..8a4e5445 100755
--- a/scripts/rabbitmqctl.bat
+++ b/scripts/rabbitmqctl.bat
@@ -30,6 +30,10 @@ REM
REM Contributor(s): ______________________________________.
REM
+if "%RABBITMQ_NODENAME%"=="" (
+ set RABBITMQ_NODENAME=rabbit
+)
+
if not exist "%ERLANG_HOME%\bin\erl.exe" (
echo.
echo ******************************
@@ -42,4 +46,4 @@ if not exist "%ERLANG_HOME%\bin\erl.exe" (
exit /B
)
-"%ERLANG_HOME%\bin\erl.exe" -pa "%~dp0..\ebin" -noinput -hidden %RABBITMQ_CTL_ERL_ARGS% -sname rabbitmqctl -s rabbit_control -extra %*
+"%ERLANG_HOME%\bin\erl.exe" -pa "%~dp0..\ebin" -noinput -hidden %RABBITMQ_CTL_ERL_ARGS% -sname rabbitmqctl -s rabbit_control -nodename %RABBITMQ_NODENAME% -extra %*
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index cf20520e..5bc8ad06 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -52,10 +52,12 @@
%%----------------------------------------------------------------------------
start() ->
+ {ok, [[Nodenamestr|_]|_]} = init:get_argument(nodename),
+ Nodename = list_to_atom(Nodenamestr),
FullCommand = init:get_plain_arguments(),
#params{quiet = Quiet, node = Node, command = Command, args = Args} =
parse_args(FullCommand, #params{quiet = false,
- node = rabbit_misc:localnode(rabbit)}),
+ node = rabbit_misc:localnode(Nodename)}),
Inform = case Quiet of
true -> fun(_Format, _Args1) -> ok end;
false -> fun(Format, Args1) ->