Skip to content

Instantly share code, notes, and snippets.

@jbuck
Created April 8, 2016 22:57
Show Gist options
  • Save jbuck/50018d9a1fef3916ced568391f280515 to your computer and use it in GitHub Desktop.
Save jbuck/50018d9a1fef3916ced568391f280515 to your computer and use it in GitHub Desktop.
Watch for ELB scaling via DNS record changes
#!/bin/bash
DOMAIN="$1"
OLD_RECORDS="`dig +short @8.8.8.8 $DOMAIN A | sort`"
echo `date` $OLD_RECORDS
while true; do
sleep 30
NEW_RECORDS="`dig +short @8.8.8.8 $DOMAIN A | sort`"
if [ "$OLD_RECORDS" != "$NEW_RECORDS" ]; then
echo `date` $NEW_RECORDS
OLD_RECORDS="`dig +short @8.8.8.8 $DOMAIN A | sort`"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment