Last active
November 9, 2021 01:36
-
-
Save aroxu/58c0691db1f766ac68a93ee98a7b0eb1 to your computer and use it in GitHub Desktop.
Afraid ORG FreeDDNS IP Updater
This file contains hidden or 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/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