update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERS='4.7.143-06232023'
|
||||
VERS='4.7.144-06232023'
|
||||
|
||||
# NODETYPES=WEB
|
||||
NODETYPES=LB,LPD,MM,MYSQL,NC,PW,WPD,WM,WEB
|
||||
|
||||
@@ -989,45 +989,50 @@ ADD_LOGROTATE_CRONTAB(){
|
||||
}
|
||||
|
||||
UPDATE_DYNDNS(){
|
||||
if [ "${2}" != 'q' ]; then
|
||||
echo -e "${idsCL[LightCyan]}Updating Primary DNS A records with any WAN IP changes... ${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
|
||||
NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com`
|
||||
|
||||
if [ "${OLDIP}" != "${NEWIP}" ] && [ "${NEWIP}" != ";; connection timed out; no servers could be reached" ]; 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
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=scity.us&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=schroedercity.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=dasrei.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=snsinvest.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=misfitsmc.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
|
||||
elif [ "${1}" == "offsite" ]; then
|
||||
/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 from '${OLDIP}' to '${NEWIP}'${idsCL[Default]}"
|
||||
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)"
|
||||
|
||||
elif [ "${NEWIP}" == ";; connection timed out; no servers could be reached" ]; 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"
|
||||
else
|
||||
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}${1^^} WAN IP has not changed '${OLDIP}' = '${NEWIP}'${idsCL[Default]}"
|
||||
fi
|
||||
if [ "${2}" != 'q' ]; then
|
||||
echo -e "${idsCL[LightCyan]}Updating Primary DNS A records with any WAN IP changes... ${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
|
||||
NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com`
|
||||
|
||||
if [ "${OLDIP}" != "${NEWIP}" ] && [ "${NEWIP}" != ";; connection timed out; no servers could be reached" ]; 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
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=scity.us&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=schroedercity.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=dasrei.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=snsinvest.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
/usr/bin/curl -s "https://systems:Dcs9613@wdns.scity.us/nic/update?hostname=misfitsmc.com&myip=${NEWIP}" > /dev/null 2>&1
|
||||
|
||||
elif [ "${1}" == "offsite" ]; then
|
||||
/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 from '${OLDIP}' to '${NEWIP}'${idsCL[Default]}"
|
||||
|
||||
elif [ "${NEWIP}" == ";; connection timed out; no servers could be reached" ]; 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"
|
||||
else
|
||||
[ "${2}" != 'q' ] && echo -e "${idsCL[Green]}${1^^} WAN IP has not changed '${OLDIP}' = '${NEWIP}'${idsCL[Default]}"
|
||||
fi
|
||||
|
||||
if [ "${2}" != 'q' ]; then
|
||||
echo ""
|
||||
read -n 1 -s -p "Press any key to continue"
|
||||
echo
|
||||
if [ "${2}" != 'q' ]; then
|
||||
echo ""
|
||||
read -n 1 -s -p "Press any key to continue"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user