diff --git a/usr/local/bin/dynv6 b/usr/local/bin/dynv6 old mode 100755 new mode 100644 index 329f968..8c3834e --- a/usr/local/bin/dynv6 +++ b/usr/local/bin/dynv6 @@ -95,7 +95,8 @@ echo "Checking ${hostname}" # ipv6 if [ "${DYNV6_IPV6_ENABLED}" = "true" ]; then echo "Testing IPv6"; - ipv6Res=$(curl -fsS "http://ipv6.dynv6.com/api/update?hostname=${hostname}&ipv6=auto&token=${token}") + ipv6Address=$(curl -s "https://v6.ident.me/") + ipv6Res=$(curl -fsS "http://ipv6.dynv6.com/api/update?hostname=${hostname}&ipv6=${ipv6Address}&token=${token}") ipv6Changed=true; if [ "${ipv6Res}" = "addresses unchanged" ]; then @@ -106,7 +107,7 @@ if [ "${DYNV6_IPV6_ENABLED}" = "true" ]; then if [ "${DYNV6_MAIL_ENABLED}" = "true" ]; then HOSTMACHINE=$(hostname) - echo -e "IPv6 for ${hostname} on host ${HOSTMACHINE} changed" | mailx -s "[dynv6 IPv6 ${HOSTMACHINE}] IPv6 changed for ${hostname}" "${DYNV6_MAIL_ADDRESS}" + echo -e "IPv6 for ${hostname} on host ${HOSTMACHINE} changed to ${ipv6Address}" | mailx -s "[dynv6 IPv6 ${HOSTMACHINE}] IPv6 changed for ${hostname}" "${DYNV6_MAIL_ADDRESS}" fi fi fi @@ -114,7 +115,8 @@ fi # ipv4 if [ "${DYNV6_IPV4_ENABLED}" = "true" ]; then echo "Testing IPv4"; - ipv4Res=$(curl -fsS "http://ipv4.dynv6.com/api/update?hostname=${hostname}&ipv4=auto&token=${token}") + ipv4Address=$(curl -s "https://v4.ident.me/") + ipv4Res=$(curl -fsS "http://ipv4.dynv6.com/api/update?hostname=${hostname}&ipv4=${ipv4Address}&token=${token}") ipv4Changed=true; if [ "$ipv4Res" = "addresses unchanged" ]; then ipv4Changed=false; @@ -124,7 +126,7 @@ if [ "${DYNV6_IPV4_ENABLED}" = "true" ]; then if [ "${DYNV6_MAIL_ENABLED}" = "true" ]; then HOSTMACHINE=$(hostname) - echo -e "IPv4 for ${hostname} on host ${HOSTMACHINE} changed" | mailx -s "[dynv6 IPv4 ${HOSTMACHINE}] IPv4 changed for ${hostname}" "${DYNV6_MAIL_ADDRESS}" + echo -e "IPv4 for ${hostname} on host ${HOSTMACHINE} changed changed to ${ipv4Address}" | mailx -s "[dynv6 IPv4 ${HOSTMACHINE}] IPv4 changed for ${hostname}" "${DYNV6_MAIL_ADDRESS}" fi fi fi \ No newline at end of file