Created
May 18, 2009 20:56
-
-
Save anonymous/113740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
%%! -smp enable -sname cli | |
-define(NODE, test@localhost). | |
main(_) -> | |
os:cmd("epmd -daemon"), | |
start(), | |
ping(). | |
start() -> | |
Cmd = io_lib:format("erl -detached -sname ~p", [?NODE]), | |
os:cmd(Cmd). | |
ping() -> | |
timer:sleep(3000), | |
case net_adm:ping(?NODE) of | |
pong -> | |
io:format("# Node ~p has been successfully started, I'll stop it for you.~n", [?NODE]), | |
rpc:call(?NODE, init, stop, []); | |
pang -> | |
io:format("# I don't see the node. ~p~n", [?NODE]), | |
io:format("# But it's still running. You should stop the faulty node by smth like \"killall beam.smp\"~n") | |
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
-define(NODE, test@localhost). | |
main(_) -> | |
os:cmd("epmd -daemon"), | |
net_kernel:start([cli, shortnames]), | |
start(), | |
ping(). | |
start() -> | |
Cmd = io_lib:format("erl -detached -sname ~p", [?NODE]), | |
os:cmd(Cmd). | |
ping() -> | |
timer:sleep(3000), | |
case net_adm:ping(?NODE) of | |
pong -> | |
io:format("# Node ~p has been successfully started, I'll stop it for you.~n", [?NODE]), | |
rpc:call(?NODE, init, stop, []); | |
pang -> | |
io:format("# I don't see the node. ~p~n", [?NODE]), | |
io:format("# But it's still running. You should stop the faulty node by smth like \"killall beam.smp\"~n") | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment