Skip to content

Instantly share code, notes, and snippets.

@cstar
Created April 20, 2010 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cstar/372206 to your computer and use it in GitHub Desktop.
Save cstar/372206 to your computer and use it in GitHub Desktop.
%#!/usr/bin/env escript
%%! -sasl errlog_type info -boot start_sasl -noshell -sname ejabberd
% returns on stdout all nodes called NodeName on the EC2 security group.
main([NodeName])->
catch ec2nodefinder:start(),
Nodes = case catch ec2nodefinder:discover() of
{ok, N}-> N;
_ ->
[]
end,
Others = Nodes -- [{node(), pong}],
R = lists:foldl(
fun({Node, _}, not_found)-> %need to find at least one riak node
case atom_to_list(Node) of
NodeName ++ "@" ++ _Rest ->
io:format("~s", [Node]);
_ -> not_found
end;
(_, Acc) -> Acc
end, not_found, Others).
@cstar
Copy link
Author

cstar commented Apr 20, 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment