Last active
August 29, 2015 14:21
-
-
Save dfrankland/e81184266f529373413d to your computer and use it in GitHub Desktop.
Check for changes in WAN ip using http://ifconfig.me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ip1=""; | |
ip2=""; | |
changed=0; | |
date1=$( date "+%s" ) | |
while true; do | |
ip1=$(curl -s ifconfig.me/ip); | |
if [[ "$ip1" != "$ip2" ]]; then | |
changed=$(( changed + 1 )); | |
date2=$( date "+%s" ) | |
diff=$(( date2 - date1 )) | |
echo "Changed IP: $ip1 | Changed Total: $changed | Time Change: $(( diff / 60 )) min. $(( diff % 60 )) sec. | Time: $( date "+%c" )"; | |
ip2=$ip1; | |
date1=$date2 | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Easy way to run this: