summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2010-11-30 15:57:26 +0000
committerEmile Joubert <emile@rabbitmq.com>2010-11-30 15:57:26 +0000
commit69dda299b699fc755d906f38f173c7b4b1879e2c (patch)
treeb45e63e71255c4d9aa9b270f125c6238b7ba8d48 /src
parent275195fc340fa8ed14e13be82cd6fa82fc13d10e (diff)
downloadrabbitmq-server-git-69dda299b699fc755d906f38f173c7b4b1879e2c.tar.gz
Check if nodename is available before startup
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_plugin_activator.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rabbit_plugin_activator.erl b/src/rabbit_plugin_activator.erl
index 072f297e69..59d8efd484 100644
--- a/src/rabbit_plugin_activator.erl
+++ b/src/rabbit_plugin_activator.erl
@@ -29,7 +29,7 @@
%% Contributor(s): ______________________________________.
%%
--module(rabbit_plugin_activator).
+-module(rabbit_prelaunch).
-export([start/0, stop/0]).
@@ -52,7 +52,7 @@ start() ->
io:format("Activating RabbitMQ plugins ...~n"),
%% Determine our various directories
- [PluginDir, UnpackedPluginDir] = init:get_plain_arguments(),
+ [PluginDir, UnpackedPluginDir, NodeName] = init:get_plain_arguments(),
RootName = UnpackedPluginDir ++ "/rabbit",
%% Unpack any .ez plugins
@@ -130,6 +130,13 @@ start() ->
[io:format("* ~s-~s~n", [App, proplists:get_value(App, AppVersions)])
|| App <- PluginApps],
io:nl(),
+ case net_kernel:start([list_to_atom(NodeName), shortnames]) of
+ {ok, _Pid} -> ok = net_kernel:stop();
+ {error, Result} ->
+ terminate("starting node with name ~p failed - "
+ "an instance with the same name may already be running~n~p~n",
+ [NodeName, Result])
+ end,
halt(),
ok.