File tree Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ start-background-node: all
207207 -rm -f $(RABBITMQ_MNESIA_DIR ) .pid
208208 mkdir -p $(RABBITMQ_MNESIA_DIR )
209209 setsid sh -c " $( MAKE) run-background-node > $( RABBITMQ_MNESIA_DIR) /startup_log 2> $( RABBITMQ_MNESIA_DIR) /startup_err" &
210- sleep 5
210+ ./wait_node $( RABBITMQ_NODENAME ) $( RABBITMQ_MNESIA_DIR ) .pid
211211
212212start-rabbit-on-node : all
213213 echo " rabbit:start()." | $(ERL_CALL )
Original file line number Diff line number Diff line change 211211-spec (os_cmd / 1 :: (string ()) -> string ()).
212212-spec (gb_sets_difference / 2 :: (gb_set (), gb_set ()) -> gb_set ()).
213213-spec (is_running / 2 :: (node (), atom ()) -> boolean ()).
214- -spec (wait_for_application / 3 :: (node (), pid (), atom ())
214+ -spec (wait_for_application / 3 :: (node (), string (), atom ())
215215 -> ok | {error , process_not_running }).
216- -spec (wait_for_process_death / 1 :: (pid ()) -> ok ).
217- -spec (read_pid_file / 2 :: (file :name (), boolean ()) -> pid () | no_return ()).
216+ -spec (wait_for_process_death / 1 :: (string ()) -> ok ).
217+ -spec (read_pid_file / 2 :: (file :name (), boolean ()) -> string () | no_return ()).
218218
219219-endif .
220220
@@ -1000,6 +1000,3 @@ system(Cmd) ->
10001000% Escape the quotes in a shell command so that it can be used in "sh -c 'cmd'"
10011001escape_quotes (Cmd ) ->
10021002 lists :flatten (lists :map (fun ($' ) -> " '\\ ''" ; (Ch ) -> Ch end , Cmd )).
1003-
1004- format_parse_error ({_Line , Mod , Err }) ->
1005- lists :flatten (Mod :format_error (Err )).
Original file line number Diff line number Diff line change 1+ #!/ usr / bin / env escript
2+ % % -*- erlang -*-
3+ % %! -sname wait_node -pa ./ebin
4+
5+ main ([NodeStr , PidFile ]) ->
6+ case {code :load_file (rabbit_misc ), code :load_file (rabbit_nodes )} of
7+ {{module , _ }, {module , _ }} ->
8+ ok ;
9+ _ ->
10+ io :format (" Compile with 'make' before running this script~n " )
11+ end ,
12+ Node = rabbit_nodes :make (NodeStr ),
13+ Pid = rabbit_misc :read_pid_file (PidFile , true ),
14+ io :format (" pid is ~s~n " , [Pid ]),
15+ rabbit_misc :wait_for_application (Node , Pid , kernel );
16+ main (_ ) ->
17+ usage ().
18+
19+ usage () ->
20+ io :format (" Usage: ./wait_node node pidfile~n " ),
21+ halt (1 ).
You can’t perform that action at this time.
0 commit comments