Update nodemgmt-scripts.sh

This commit is contained in:
2025-05-26 22:27:07 -05:00
parent 4e9533afd6
commit dee1ce1ab8

View File

@@ -499,14 +499,11 @@ UPDATE_DYNDNS(){
echo -en "${idsCL[White]}Current WAN IP : "; echo -en "${idsCL[White]}Current WAN IP : ";
NEWIP="$(dig +short myip.opendns.com @resolver1.opendns.com)" >/dev/null 2>&1 NEWIP="$(dig +short myip.opendns.com @resolver1.opendns.com)" >/dev/null 2>&1
if [ "${NEWIP}" == "" ]; then if [ "${NEWIP}" == "" ]; then
NEWIP="$(host myip.opendns.com resolver1.opendns.com)" >/dev/null 2>&1 NEWIP="$(curl https://ipinfo.io/ip)" >/dev/null 2>&1
if [ "${NEWIP}" == "" ]; then if [ "${NEWIP}" == "" ]; then
NEWIP="$(curl https://ipinfo.io/ip)" >/dev/null 2>&1 NEWIP="$(wget -qO- https://ipecho.net/plain ; echo)" >/dev/null 2>&1
if [ "${NEWIP}" == "" ]; then else
NEWIP="$(wget -qO- https://ipecho.net/plain ; echo)" >/dev/null 2>&1 NEWIP="WAN IP could not be found"
else
NEWIP="WAN IP could not be found"
fi
fi fi
fi fi
# NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com +time=2`; # NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com +time=2`;
@@ -525,9 +522,9 @@ UPDATE_DYNDNS(){
fi fi
if [ "${NM_PDNS_USER}" != "" ] && [ "${NM_PDNS_PASS}" != "" ]; then if [ "${NM_PDNS_USER}" != "" ] && [ "${NM_PDNS_PASS}" != "" ]; then
if [ "$(curl -m 3 -sL "https://${NM_PDNS_USER}df:${NM_PDNS_PASS}@${PDNS_SERVER}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then if [ "$(curl -m 3 -sL "https://${NM_PDNS_USER}df:${NM_PDNS_PASS}@${PDNS_SERVER}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
for host in ${DYNDNS_HOSTS[@]}; do # for host in ${DYNDNS_HOSTS[@]}; do
/usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${PDNS_SERVER}/nic/update?hostname=${host}&myip=${NEWIP}" > /dev/null 2>&1 # /usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${PDNS_SERVER}/nic/update?hostname=${host}&myip=${NEWIP}" > /dev/null 2>&1
done # done
if [ "${NM_PDNS_USER}" == "systems" ]; then if [ "${NM_PDNS_USER}" == "systems" ]; then
[ "${LOCATION,,}" == "mainsite" ] && /usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${NM_PDNS_LANDNS}/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1 [ "${LOCATION,,}" == "mainsite" ] && /usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${NM_PDNS_LANDNS}/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1
[ "${LOCATION,,}" == "offsite" ] && /usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${NM_PDNS_LANDNS}/nic/update?hostname=wan.offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1 [ "${LOCATION,,}" == "offsite" ] && /usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${NM_PDNS_LANDNS}/nic/update?hostname=wan.offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1