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.
This commit is contained in:
parent
848d673257
commit
d9a44ff531
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user