Created
April 20, 2010 08:47
-
-
Save cstar/372206 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 | |
%%! -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). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ec2nodefinder : http://github.com/cstar/ec2nodefinder