summaryrefslogtreecommitdiff
path: root/wait_node
blob: ee7dfeab0f04c5ea62d617fffdec6b5ba2a1bfc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -sname wait_node -pa ./ebin

main([NodeStr, PidFile]) ->
    case {code:load_file(rabbit_misc), code:load_file(rabbit_nodes)} of
        {{module, _}, {module, _}} ->
            ok;
        _ ->
            io:format("Compile with 'make' before running this script~n"),
            halt(1)
    end,
    Node = rabbit_nodes:make(NodeStr),
    Pid = rabbit_misc:read_pid_file(PidFile, true),
    io:format("pid is ~s~n", [Pid]),
    rabbit_misc:wait_for_application(Node, Pid, kernel);
main(_) ->
    usage().

usage() ->
    io:format("Usage: ./wait_node node pidfile~n"),
    halt(1).