Last active
May 1, 2019 00:33
-
-
Save sterling/08132bb4c80480c42e6f5a00256844ea to your computer and use it in GitHub Desktop.
ASUS Merlin Google DDNS script (/jffs/scripts/ddns-start)
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
#!/bin/sh | |
host= | |
user= | |
pass= | |
wanip=$1 | |
resolvedip=$(nslookup $host | grep $host -A1 | awk '/^Address / {print $3}') | |
if [ "$wanip" == "$resolvedip" ]; then | |
logger "Google Domains DDNS: WAN IP ($wanip) unchanged, no update necessary" | |
/sbin/ddns_custom_updated 1 | |
else | |
response=$(curl -s https://$user:[email protected]/nic/update?hostname=$host&myip=$wanip) | |
if [ "$response" == "good $wanip" ]; then | |
logger "Google Domains DDNS: DNS updated to $wanip from $resolvedip" | |
/sbin/ddns_custom_updated 1 | |
else | |
logger "Google Domains DDNS: Update error. $response" | |
/sbin/ddns_custom_updated 0 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment