diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index a2e12410..89ca5e37 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -548,34 +548,40 @@ UPDATE_DYNDNS(){ echo -en "${idsCL[Green]}'${idsCL[LightCyan]}${LOCATION^^}${idsCL[Green]}' WAN IP has changed, updating all pre-defined 'A' records ... " fi if [ "${NM_DYNUSER}" != "" ] && [ "${NM_DYNPASS}" != "" ]; then - if [ "${LOCATION,,}" == "mainsite" ]; then - #external dns - /usr/bin/curl "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 [ "$(/usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update")" != "" ]; 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 -e "\n\n${idsCL[LightRed]}INVALID DYNDNS username and/or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})\n" + # SENDNOTICE "${LOCATION^^} DYNDNS ERROR" "INVALID DYNDNS username or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" 1 + exit 1 fi - echo -e "${idsCL[Green]}Done${idsCL[Default]}" else echo -e "\n\n${idsCL[LightRed]}Missing DYNDNS username and/or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})\n" - # SENDNOTICE "${LOCATION^^} DYNDNS ERROR" "Missing DYNDNS username or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" 1 + # SENDNOTICE "${LOCATION^^} DYNDNS ERROR" "MISSING DYNDNS username or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})" 1 exit 1 fi