Update nodemgmt-scripts.sh

This commit is contained in:
2023-06-30 18:21:18 -05:00
parent 2af736529c
commit 8083579054

View File

@@ -994,15 +994,27 @@ UPDATE_DYNDNS(){
else
if [ "${2}" != 'q' ]; then
cw_spc=20
echo -e "${idsCL[LightCyan]}Checking for DYNDNS update at ${1^} ... ${idsCL[Default]}"
msg="Old IP:"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en "${idsCL[LightCyan]}${msg}${spc}${idsCL[White]}: ${idsCL[Default]}"
fi
if [ "${1}" == "home" ]; then
OLDIP=`dig +short sc1.scity.us @ns1.scity.us`
elif [ "${1}" == "offsite" ]; then
OLDIP=`dig +short offsite.scity.us @ns1.scity.us`
fi
if [ "${2}" != 'q' ]; then
echo -e "${idsCL[Green]}${OLDIP}"
msg="New IP:"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en "${idsCL[LightCyan]}${msg}${spc}${idsCL[White]}: ${idsCL[Default]}"
fi
NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com`
if [ "${2}" != 'q' ]; then
echo -e "${idsCL[Green]}${NEWIP}"
fi
if ([ "${OLDIP}" != "" ] && [ "${NEWIP}" != "" ] && [[ "${NEWIP}" != *";"* ]] && [ "${OLDIP}" != "${NEWIP}" ]) || [ "${2}" == "force" ]; then
if [ "${1}" == "home" ]; then
@@ -1029,7 +1041,7 @@ UPDATE_DYNDNS(){
elif [ "${NEWIP}" == "" ]; then
[ "${2}" != 'q' ] && echo -e "${idsCL[Red]}Could not get NEW IP${idsCL[Default]}"
else
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}${1^^} WAN IP has not changed '${OLDIP}' = '${NEWIP}'${idsCL[Default]}"
[ "${2}" != 'q' ] && echo; echo -e "${idsCL[Green]}${1^^} WAN IP has not changed${idsCL[Default]}"
fi
echo