Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
update cloudns ddns from plain OpenWRT
#!/bin/ash
CURRENT_IP=$(wget -q http://whatismyip.akamai.com/ -O -)
CLOUDNS_HANDLE="example.com" # <<<--- YOUR DNS NAME
CLOUDNS_SERVER=109.201.133.194 # DNS SERVER
echo "current IP: $CURRENT_IP"
DNS_IP=$(nslookup $CLOUDNS_HANDLE $CLOUDNS_SERVER | awk '/guest-wan.pw.cloudns.pro/,/Address/' | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
echo "DNS IP: $DNS_IP"
case $DNS_IP in
"$CURRENT_IP")
exit 0
;;
*)
URL="XXX" # <<<--- THIS IS YOU API TOKEN FROM CLOUDNS DASHBOARD
wget -q http://ipv4.cloudns.net/api/dynamicURL/?q="$URL" -O /dev/null
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment