Skip to content

Instantly share code, notes, and snippets.

@sonicintrusion
Created January 10, 2019 01:39
Show Gist options
  • Save sonicintrusion/8684ac5634c195ccfe81e296eba1a5bc to your computer and use it in GitHub Desktop.
Save sonicintrusion/8684ac5634c195ccfe81e296eba1a5bc to your computer and use it in GitHub Desktop.
dyndns check
#!/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