Update nodemgmt-scripts.sh

This commit is contained in:
2025-05-26 22:23:37 -05:00
parent 488d918b69
commit 4e9533afd6

View File

@@ -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