Update nodemgmt-scripts.sh

This commit is contained in:
2023-06-30 18:30:59 -05:00
parent 698143ca54
commit 9361fb8634

View File

@@ -1010,11 +1010,10 @@ UPDATE_DYNDNS(){
echo -en "${idsCL[LightCyan]}New IP ${idsCL[White]}: "
fi
NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com`
if [ "${2}" != 'q' ]; then
echo -e "${idsCL[Green]}${NEWIP}"
fi
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}${NEWIP}"
if ([ "${OLDIP}" != "" ] && [ "${NEWIP}" != "" ] && [[ "${NEWIP}" != *";"* ]] && [ "${OLDIP}" != "${NEWIP}" ]) || [ "${2}" == "force" ]; then
[ "${2}" != 'q' ] && echo; echo -en "${idsCL[Green]}${1^} WAN IP has changed, updating records ... "
if [ "${1}" == "home" ]; then
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=sc2.scity.us&myip=${NEWIP}" > /dev/null 2>&1
@@ -1028,12 +1027,12 @@ UPDATE_DYNDNS(){
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1
fi
SENDNOTICE "Updated ${1^} WAN IP from '${OLDIP}' to '${NEWIP}'" "${1^^} DYNDNS Updated"
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}Updated ${1^} WAN IP successful${idsCL[Default]}"
SENDNOTICE "${1^^} DYNDNS Updated" "Updated ${1^} WAN IP from '${OLDIP}' to '${NEWIP}'"
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}done${idsCL[Default]}"
elif [[ "${NEWIP}" == *";"* ]]; then
[ "${2}" != 'q' ] && echo -e "${idsCL[Red]}Could reach any servers${idsCL[Default]}"
# SENDNOTICE "Connection error, could reach any servers" "${1^^} DYNDNS Could not Update"
# SENDNOTICE "${1^^} DYNDNS Could not Update" "Connection error, could reach any servers"
elif [ "${OLDIP}" == "" ]; then
[ "${2}" != 'q' ] && echo -e "${idsCL[Red]}Could not get OLD IP${idsCL[Default]}"
elif [ "${NEWIP}" == "" ]; then