I want to restart ntpd service on all remote machines so
All the machines are on amazon aws cloud.
So I wrote following script but while loop executes only once. Not getting exact issue.
ec2-describe-instances --filter "instance-state-name=running" --show-empty-fields | grep INSTANCE | awk '{print $18}'|sort > ntpd_restart_IP.txt
while read line
do
#echo ssh -i /mnt/keys/abc.pem root@$line /etc/init.d/ntpd restart
ssh -i /mnt/keys/abc.pem root@$line /etc/init.d/ntpd restart
done < ntpd_restart_IP.txt
Total 80 machines are there but it works only for first entry in ntpd_restart_IP.txt file.