Skip to content

Instantly share code, notes, and snippets.

@elamperti
Created April 3, 2017 05:20
Show Gist options
  • Save elamperti/3d34a567ed099baef6b2f68583a565c0 to your computer and use it in GitHub Desktop.
Save elamperti/3d34a567ed099baef6b2f68583a565c0 to your computer and use it in GitHub Desktop.
Marlin's firmware DDNS update for Google Domains
#!/bin/sh
# (Copied from Marlin's examples)
# This script should be placed at /jffs/scripts/ddns-start
# chmod a+x ddns-start
# Finally set to custom in WAN -> DDNS.
# more info: https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS#google-domains
# Get the following login info from Google Domains' dashboard
U=???
P=???
D=your.domain
H=subdomain
google_dns_update() {
CMD=$(curl -s https://$1:$2@domains.google.com/nic/update?hostname=$4.$3)
logger "google-ddns-updated: $CMD"
case "$CMD" in
good*|nochg*) /sbin/ddns_custom_updated 1 ;;
abuse) /sbin/ddns_custom_updated 1 ;;
*) /sbin/ddns_custom_updated 0 ;;
esac
}
google_dns_update $U $P $D $H
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment