From 4e9533afd669145ab5f7edbf81df8dc1b5db1f25 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 26 May 2025 22:23:37 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index bac93fe9..156ab643 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -493,8 +493,24 @@ UPDATE_DYNDNS(){ cw_spc=10 echo -e "Checking for DYNDNS update at '${idsCL[Green]}${LOCATION^^}${idsCL[Default]}'" echo - echo -en "${idsCL[White]}Previous WAN IP : "; OLDIP=`dig +short ${DYNDNS_HOSTS[0]} @${PDNS_SERVER} +time=2`; echo -e "${idsCL[Cyan]}${OLDIP}" - echo -en "${idsCL[White]}Current WAN IP : "; NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com +time=2`; echo -e "${idsCL[LightGreen]}${NEWIP}" + echo -en "${idsCL[White]}Previous WAN IP : "; + OLDIP=`dig +short ${DYNDNS_HOSTS[0]} @${PDNS_SERVER} +time=2`; + echo -e "${idsCL[Cyan]}${OLDIP}" + echo -en "${idsCL[White]}Current WAN IP : "; + NEWIP="$(dig +short myip.opendns.com @resolver1.opendns.com)" >/dev/null 2>&1 + if [ "${NEWIP}" == "" ]; then + NEWIP="$(host myip.opendns.com resolver1.opendns.com)" >/dev/null 2>&1 + if [ "${NEWIP}" == "" ]; then + NEWIP="$(curl https://ipinfo.io/ip)" >/dev/null 2>&1 + if [ "${NEWIP}" == "" ]; then + NEWIP="$(wget -qO- https://ipecho.net/plain ; echo)" >/dev/null 2>&1 + else + NEWIP="WAN IP could not be found" + fi + fi + fi + # NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com +time=2`; + echo -e "${idsCL[LightGreen]}${NEWIP}" echo if ([ "${OLDIP}" != "" ] && [ "${NEWIP}" != "" ] && [[ "${OLDIP}" != *";"* ]] && [[ "${NEWIP}" != *";"* ]]) && ([ "${OLDIP}" != "${NEWIP}" ] || [ ${FORCE} -eq 1 ]); then