From d9a44ff5319097984da52e28baee4f1d15b1b420 Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 9 Mar 2018 23:45:04 +0200 Subject: [PATCH] A better way to ensure we only get the IPv4 address. An added advantage is that, if we check the IP on the VPN host, we should get our actual IP address, not the VPN-assigned address. --- update_ip.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/update_ip.sh b/update_ip.sh index fbf3135..16fec01 100755 --- a/update_ip.sh +++ b/update_ip.sh @@ -6,7 +6,7 @@ zone=dyn.example.com host=desktop secret="" -ip=$(wget -q -O - http://treehouse.org.za/ip) +ip=$(wget -4 -q -O - http://treehouse.org.za/ip) set_ip=$(dig +short ${host}.${zone}) if [ -z ${ip} ] || [ -z ${cache} ]; then @@ -17,11 +17,6 @@ if [ -f "${HOME}/${cache}" ]; then old_ip=$(cat "${HOME}/${cache}") fi -# Exit if we're at an IPv6 address -if [ -z "${ip##*:*}" ]; then - exit; -fi - if [ "${set_ip}" = "${ip}" ] && [ "${ip}" = "${old_ip}" ]; then exit; else