Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have this bash line that gives me the IPs of the EC2 instances attached.

export LB_NAME='lb'
ec2-describe-instances `elb-describe-instance-health $LB_NAME --show-long | cut -d , -f 2` | grep 'INSTANCE' | cut  -f 4

This echoes something like this:

ec2-50-11-53-xx.compute-1.amazonaws.com
ec2-50-76-13-xx.compute-1.amazonaws.com

Now, as this list can get longer when the autoscaler adds more boxes to the loadbalancer, I would like to have a bash loop that pings each one of them regardless of how many are there.

Thanks a lot!

share|improve this question

1 Answer 1

up vote 5 down vote accepted

<rest of pipeline> | xargs ping -c 1

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.