Skip to content

Instantly share code, notes, and snippets.

@ushkinaz
Created November 11, 2017 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ushkinaz/16b2c8c069313e76cb469725b39617f1 to your computer and use it in GitHub Desktop.
Save ushkinaz/16b2c8c069313e76cb469725b39617f1 to your computer and use it in GitHub Desktop.
nsupdate.info DDNS update script for asuswrt-merlin
#!/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
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"
if [ $ACTUAL_IP != $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