Skip to content

Instantly share code, notes, and snippets.

@aroxu
Last active November 9, 2021 01:36
Show Gist options
  • Save aroxu/58c0691db1f766ac68a93ee98a7b0eb1 to your computer and use it in GitHub Desktop.
Save aroxu/58c0691db1f766ac68a93ee98a7b0eb1 to your computer and use it in GitHub Desktop.
Afraid ORG FreeDDNS IP Updater
#!/bin/sh
#freedns.afraid.org updater script
# Get your update url at http://freedns.afraid.org/api/ and click XML
UPDATEURL="http://freedns.afraid.org/dynamic/update.php?"
DOMAIN="aaaa.mooo.com"
DDNS=$(nslookup $DOMAIN|tail -n2|grep A|sed s/[^0-9.]//g)
MYIP=$(curl -s "http://api.ip.pe.kr/")
echo "DDNS IP: $DDNS"
echo "Server IP: $MYIP"
if [ "$DDNS" != "$MYIP" ]; then
echo "Server's IP Changed! Updating DDNS..."
wget -q -O /dev/null $UPDATEURL
echo "DNS Updated on "; date
else
echo "IP not changed!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment