#!/bin/bash
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text --profile nash >> mainusa.txt
while true
do
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text --profile nash >> freshusa.txt
diff -Naur mainusa.txt freshusa.txt > my.patch
check=$(cat my.patch | wc -l)
echo $check
if [ "$check" -gt 0 ]
then
patch mainusa.txt < my.patch
else
echo "no chnage"
fi
rm -fr freshusa.txt my.patch
sleep 30
done
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text --profile nash >> mainusa.txt
while true
do
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text --profile nash >> freshusa.txt
diff -Naur mainusa.txt freshusa.txt > my.patch
check=$(cat my.patch | wc -l)
echo $check
if [ "$check" -gt 0 ]
then
patch mainusa.txt < my.patch
else
echo "no chnage"
fi
rm -fr freshusa.txt my.patch
sleep 30
done
No comments:
Post a Comment