add option to write out pid file
[fuzed.git] / elibs / fuzed_util.erl
blob4844d70a2528532438fdb79d9fe849514d04e59d
1 -module(fuzed_util).
3 -export([write_pid/1, cycle/1, cycle_all/1, cycle_all/2]).
5 write_pid([Location]) ->
6 Pid = os:getpid(),
7 ok = file:write_file(Location, list_to_binary(Pid)),
8 ok.
10 cycle([Node]) when is_list(Node) ->
11 cycle(list_to_atom(Node));
12 cycle(Node) ->
13 pong = net_adm:ping(Node),
14 timer:sleep(2000),
15 resource_manager:cycle(Node),
16 ok.
18 cycle_all([Master, Delay]) ->
19 cycle_all(list_to_atom(Master), list_to_integer(Delay)),
20 ok.
22 cycle_all(Master, Delay) ->
23 pong = net_adm:ping(Master),
24 timer:sleep(2000),
25 rails_connection_pool:cycle_all(Delay),
26 ok.