Created
August 31, 2011 20:53
-
-
Save videlalvaro/1184689 to your computer and use it in GitHub Desktop.
Find Erlang nodes in the cluster
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 -*- | |
%%! -sname nodefinder | |
%% Usage: | |
%% chmod +x nodes.erl | |
%% ./nodes.erl 'somenode@host' | |
main([N]) -> | |
Node = list_to_atom(N), | |
case net_adm:ping(Node) of | |
pong -> | |
Nodes = rpc:call(Node, erlang, nodes, []), | |
io:format("Nodes: ~p~n", [lists:delete(node(), Nodes ++ [Node])]); | |
_ -> | |
io:format("Can't contact node: ~p~n", [Node]) | |
end, | |
ok. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment