Created
January 10, 2019 01:39
-
-
Save sonicintrusion/8684ac5634c195ccfe81e296eba1a5bc to your computer and use it in GitHub Desktop.
dyndns check
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 | |
MY_DOMAIN="gist.github.com" | |
echo "MY_DOMAIN:" $MY_DOMAIN | |
resolved=$(dig +short $MY_DOMAIN @resolver1.opendns.com) | |
echo "DIG: " $resolved | |
current=$(curl -s http://checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//') | |
echo "Check: " $current | |
if [ "$resolved" != "$current" ]; then | |
echo "ERROR: IP is not update to date" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment