Update nodemgmt-scripts.sh

This commit is contained in:
2023-11-15 08:25:42 -06:00
parent f5a6104970
commit b11dd0a9cc

View File

@@ -525,17 +525,6 @@ UPDATE_DYNDNS(){
if ([ "${OLDIP}" != "" ] && [ "${NEWIP}" != "" ] && [[ "${OLDIP}" != *";"* ]] && [[ "${NEWIP}" != *";"* ]]) && ([ "${OLDIP}" != "${NEWIP}" ] || [ ${FORCE} -eq 1 ]); then
if [ ${TESTMODE} -eq 1 ]; then
echo -e "${idsCL[Green]}'${idsCL[LightCyan]}${LOCATION^^}${idsCL[Green]}' WAN IP has changed: ${idsCL[Yellow]}testmode active and will not update records${idsCL[Default]}"
echo -en "\nDYNDNS Credential Test: "
if [ "$(curl -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@wdns.scity.us/domain/scity.us" | grep "HTTP 403 Error")" == "" ]; then
echo -e "${idsCL[Green]}Pass${idsCL[Default]}"
else
echo -e "${idsCL[LightRed]}Fail${idsCL[Default]}"
fi
if [ "$(/usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=wan.pattonfam.com")" == "good" ]; then
echo -e "${idsCL[Green]}Pass${idsCL[Default]}"
else
echo -e "${idsCL[LightRed]}Fail${idsCL[Default]}"
fi
else
if [ ${FORCE} -eq 1 ]; then
echo -en "${idsCL[Yellow]}'${idsCL[LightCyan]}${LOCATION^^}${idsCL[Yellow]}' WAN IP has not changed...\n${idsCL[Green]}but what the heck, lets update the records anyway ehh ... "
@@ -593,6 +582,15 @@ UPDATE_DYNDNS(){
else
echo -e "${idsCL[Yellow]}'${idsCL[Green]}${LOCATION^^}${idsCL[Yellow]}' WAN IP has not changed${idsCL[Default]}"
fi
if [ ${TESTMODE} -eq 1 ]; then
echo -en "\nDYNDNS Credential Test: "
if [ "$(curl -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@wdns.scity.us/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
echo -e "${idsCL[Green]}Pass${idsCL[Default]}"
else
echo -e "${idsCL[LightRed]}Fail${idsCL[Default]}"
fi
fi
else
[ "${LOCATION}" == "" ] && echo -e "\n${idsCL[LightYellow]}No DYNDNS location specified" || echo -e "\n${idsCL[Red]}DYNDNS location '${LOCATION}' not recognized"
fi