Update nodemgmt-scripts.sh

This commit is contained in:
2023-11-14 16:39:37 -06:00
parent d1c0974c21
commit 0cfe059547

View File

@@ -517,7 +517,7 @@ UPDATE_DYNDNS(){
esac
shift
done
if [ "${LOCATION}" == "mainsite" ] || [ "${LOCATION}" == "offsite" ] || [ "${LOCATION}" == "kyle" ]; then
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})"
@@ -529,11 +529,11 @@ UPDATE_DYNDNS(){
echo
echo -en "${idsCL[White]}Previous WAN IP : "
if [ "${LOCATION}" == "mainsite" ]; then
if [ "${LOCATION,,}" == "mainsite" ]; then
OLDIP=`dig +short sc1.scity.us @wdns.scity.us +time=2`
elif [ "${LOCATION}" == "offsite" ]; then
elif [ "${LOCATION,,}" == "offsite" ]; then
OLDIP=`dig +short offsite.scity.us @wdns.scity.us +time=2`
elif [ "${LOCATION}" == "kyle" ]; then
elif [ "${LOCATION,,}" == "kyle" ]; then
OLDIP=`dig +short wan.pattonfam.com @wdns.scity.us +time=2`
fi
echo -e "${idsCL[Cyan]}${OLDIP}"
@@ -549,9 +549,10 @@ UPDATE_DYNDNS(){
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 ... "
else
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
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
@@ -563,7 +564,7 @@ UPDATE_DYNDNS(){
#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
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
@@ -571,11 +572,10 @@ UPDATE_DYNDNS(){
/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
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
SENDNOTICE "${LOCATION^^} DYNDNS Updated" "Updated ${LOCATION^} WAN IP from '${OLDIP}' to '${NEWIP}'"
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
fi