update cloudns ddns from plain OpenWRT
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/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