From 46fe90bc59151194bd749004e1f63a08ccf00441 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 14 Nov 2023 16:44:20 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 54 +++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index f751a9ea..f7f5de37 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -519,11 +519,6 @@ UPDATE_DYNDNS(){ done if [ "${LOCATION,,}" == "mainsite" ] || [ "${LOCATION,,}" == "offsite" ] || [ "${LOCATION,,}" == "kyle" ]; then echo - if [ "${NM_DYNUSER}" == "" ] || [ "${NM_DYNPASS}" == "" ]; then - echo "Missing DYNDNS username or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" - SENDNOTICE "${LOCATION^^} DYNDNS ERROR" "Missing DYNDNS username or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" 1 - exit 1 - fi cw_spc=10 echo -e "Checking for DYNDNS update at '${idsCL[Green]}${LOCATION^^}${idsCL[Default]}'" echo @@ -552,31 +547,38 @@ UPDATE_DYNDNS(){ SENDNOTICE "${LOCATION^^} WAN IP Changed" "Updated '${LOCATION^}' WAN IP from '${OLDIP}' to '${NEWIP}'" echo -en "${idsCL[Green]}'${idsCL[LightCyan]}${LOCATION^^}${idsCL[Green]}' WAN IP has changed, updating all pre-defined 'A' records ... " fi - if [ "${LOCATION,,}" == "mainsite" ]; then - #external dns - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=sc2.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=scity.us&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=schroedercity.com&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=dasrei.com&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=snsinvest.com&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=misfitsmc.com&myip=${NEWIP}" > /dev/null 2>&1 - #internal dns - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@dns.scity.us/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + if [ "${NM_DYNUSER}" != "" ] && [ "${NM_DYNPASS}" != "" ]; then + if [ "${LOCATION,,}" == "mainsite" ]; then + #external dns + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=sc2.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=scity.us&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=schroedercity.com&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=dasrei.com&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=snsinvest.com&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=misfitsmc.com&myip=${NEWIP}" > /dev/null 2>&1 + #internal dns + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@dns.scity.us/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - elif [ "${LOCATION,,}" == "offsite" ]; then - #external dns - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=backup.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - #internal dns - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@dns.scity.us/nic/update?hostname=offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@dns.scity.us/nic/update?hostname=backup.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + elif [ "${LOCATION,,}" == "offsite" ]; then + #external dns + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=backup.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + #internal dns + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@dns.scity.us/nic/update?hostname=offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1 + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@dns.scity.us/nic/update?hostname=backup.scity.us&myip=${NEWIP}" > /dev/null 2>&1 - elif [ "${LOCATION,,}" == "kyle" ]; then - /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=wan.pattonfam.com&myip=${NEWIP}" > /dev/null 2>&1 + elif [ "${LOCATION,,}" == "kyle" ]; then + /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=wan.pattonfam.com&myip=${NEWIP}" > /dev/null 2>&1 + fi + echo -e "${idsCL[Green]}Done${idsCL[Default]}" + else + echo "Missing DYNDNS username and/or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" + # SENDNOTICE "${LOCATION^^} DYNDNS ERROR" "Missing DYNDNS username or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" 1 + exit 1 fi - echo -e "${idsCL[Green]}Done${idsCL[Default]}" + fi elif [[ "${NEWIP}" == *";"* ]] || [[ "${OLDIP}" == *";"* ]]; then