Created
October 5, 2020 07:02
-
-
Save roaming-debug/9ecfdfd64f01d13dea24955f12af166a to your computer and use it in GitHub Desktop.
nsupdate.info DDNS update script for asuswrt-merlin
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
#!/usr/bin/env sh | |
# nsupdate.info DDNS update script for asuswrt-merlin | |
# See | |
# https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS | |
# http://nsupdateinfo.readthedocs.io/en/ | |
# Location: /jffs/scripts/ddns-start | |
# You need to change 10 line token value and 16 line yourdomain | |
DOMAIN="domain.nsupdate.info" | |
TOKEN="token" | |
ACTUAL_IP=${1} | |
CURRENT_DDNS_IP=$(curl -s https://ipv4.nsupdate.info/myip) | |
UPDATE_COMMAND="curl -s --user $DOMAIN:$TOKEN --basic https://ipv4.nsupdate.info/nic/update?myip=$ACTUAL_IP" | |
DNS_IP=`nslookup yourdomain | tail -n1 | sed -e 's/Address 1: //'|grep -E -o '^\S*'` | |
echo "DNS_IP = $DNS_IP" | |
if [ $ACTUAL_IP -ne $CURRENT_DDNS_IP ]; then | |
echo "Updating $DOMAIN from $CURRENT_DDNS_IP to $ACTUAL_IP" | |
eval $UPDATE_COMMAND | |
/sbin/ddns_custom_updated 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment