Update nodemgmt-scripts.sh
This commit is contained in:
@@ -990,11 +990,11 @@ ADD_LOGROTATE_CRONTAB(){
|
||||
|
||||
UPDATE_DYNDNS(){
|
||||
if [ "${1}" == "q" ]; then
|
||||
SENDNOTICE "FOUND DYDNS SERVER" "IP=$(/sbin/ip -o -4 addr list eth0 |grep 255 | awk '{print $4}' | cut -d/ -f1) - HOSTNAME=$(hostname)"
|
||||
SENDNOTICE "FOUND OLD DYNDNS SERVER" "IP=$(/sbin/ip -o -4 addr list eth0 |grep 255 | awk '{print $4}' | cut -d/ -f1) - HOSTNAME=$(hostname)"
|
||||
|
||||
else
|
||||
if [ "${2}" != 'q' ]; then
|
||||
echo -e "${idsCL[LightCyan]}Updating Primary DNS A records with any WAN IP changes... ${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightCyan]}Checking for DYNDNS update at ${1^} ... ${idsCL[Default]}"
|
||||
fi
|
||||
|
||||
if [ "${1}" == "home" ]; then
|
||||
@@ -1004,7 +1004,7 @@ UPDATE_DYNDNS(){
|
||||
fi
|
||||
NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com`
|
||||
|
||||
if [ "${OLDIP}" != "${NEWIP}" ] && [ "${NEWIP}" != ";; connection timed out; no servers could be reached" ]; then
|
||||
if ([ "${OLDIP}" != "" ] && [ "${NEWIP}" != "" ] && [[ "${NEWIP}" != *";"* ]] && [ "${OLDIP}" != "${NEWIP}" ]) || [ "${2}" == "force" ]; then
|
||||
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
|
||||
@@ -1021,9 +1021,13 @@ UPDATE_DYNDNS(){
|
||||
SENDNOTICE "Updated ${1^} WAN IP from '${OLDIP}' to '${NEWIP}'" "${1^^} DYNDNS Updated"
|
||||
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}Updated ${1^} WAN IP from '${OLDIP}' to '${NEWIP}'${idsCL[Default]}"
|
||||
|
||||
elif [ "${NEWIP}" == ";; connection timed out; no servers could be reached" ]; then
|
||||
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 "Connection error, could reach any servers" "${1^^} DYNDNS Could not Update"
|
||||
elif [ "${OLDIP}" == "" ]; then
|
||||
[ "${2}" != 'q' ] && echo -e "${idsCL[Red]}Could not get OLD IP${idsCL[Default]}"
|
||||
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]}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user