USERNAME=sue
PASSWORD=hygCithOrs5
-HOSTNAME=$(hostname)
ZONE=dyn.example.com
-FQDN=$HOSTNAME.$USERNAME.$ZONE
NS=ns.example.com
-URL="http://dyndns.example.com/nic/update?hostname=$FQDN&myip="
+WEB=dyndns.example.com
+
+HOSTNAME=$(hostname)
+FQDN=$HOSTNAME.$USERNAME.$ZONE
+URL="http://$WEB/nic/update?hostname=$FQDN&myip="
WGET="wget -q --tries=2 --timeout=5"
if [ -z "$HOSTNAME" ] ; then
# data
-# alternative: -4 icanhazip.com, -6 icanhazip.com or ipv{4,6}.icanhazip.com
-NEWIPV4=$($WGET -O- http://ipv4.wtfismyip.com/text)
-NEWIPV6=$($WGET -O- http://ipv6.wtfismyip.com/text)
+NEWIPV4=$($WGET -O- http://ipv4.wtfismyip.com/text || $WGET -O- http://ipv4.icanhazip.com)
+NEWIPV6=$($WGET -O- http://ipv6.wtfismyip.com/text || $WGET -O- http://ipv6.icanhazip.com)
if command -v dig >/dev/null ; then
OLDIPV4=$(dig -t a +short $FQDN @$NS)