Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash loop to test URL propagation, including notifications when propagated
# Reminder for arguments
if [ "$1" == "-h" ]; then
echo "Arguments:
1: URL
2: New IP
Example: 879.30.33.21"
curr_ip=`nslookup $1 | grep Address | sed -n '2p' | cut -d: -f2|sed 's/^[ \t]*//'`
while [ "${2}" != "$curr_ip" ]; do
echo "$curr_ip $(date "+%T")"
sleep 300
curr_ip=`nslookup $1 | grep Address | sed -n '2p' | cut -d: -f2|sed 's/^[ \t]*//'`
echo "${1} has propagated to ${2}"
# Echo to Notification Center (requires terminal notifier Ruby gem
terminal-notifier -message "${1} has propagated to ${2}" -title "Propagation Complete" -sound "Glass"
# Other notifications
# (I use curl to text myself via the Twilio API in case I'm AFK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.