This commit is contained in:
2023-06-23 22:14:39 -05:00
parent f2b2437f48
commit 9c384b6d6a
3 changed files with 17 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='4.7.128-06212023'
VERS='4.7.130-06212023'
# NODETYPES=WEB
NODETYPES=LB,LPD,MM,MYSQL,NC,PW,WPD,WM,WEB
@@ -69,6 +69,7 @@ NGINX_PATHS['WEB']='/mnt/web-data/nginx'
declare -A NM_HOSTNAMES
NM_HOSTNAMES['10.10.1.121']='Webserver-Node1'
NM_HOSTNAMES['10.10.1.122']='Webserver-Node2'
NM_HOSTNAMES['10.10.1.24']='Media-Manager'
NM_HOSTNAMES['10.10.1.51']='MySQL-Node1'
NM_HOSTNAMES['10.10.1.52']='MySQL-Node2'
NM_HOSTNAMES['10.10.10.81']='LoadBalancer-Node1'
@@ -84,6 +85,7 @@ NM_HOSTNAMES['100.123.225.4']='WAN-DNS-Node2 (West)'
NM_HOSTNAMES['100.73.162.81']='WAN-Monitor-Node1'
NM_HOSTNAMES['3.214.174.170']='WAN-DNS-Node1 (East)'
NM_HOSTNAMES['54.213.11.227']='WAN-DNS-Node2 (West)'
NM_HOSTNAMES['10.10.1.28']='WAN-DNS-Node3 (Home)'
NM_HOSTNAMES['44.214.59.192']='WAN-Monitor-Node1'
declare -i errtime

View File

@@ -328,7 +328,7 @@ STATUS(){
fi
for docker in "${!dockers}"; do
([ "${docker}" == "vaultwarden" ] || [ "${docker}" == "heimdall" ]) && [ "${NTYPE}" == "WEB" ] && [[ $($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *${WEB_HOSTS[0]}* ]] && NOGOCHK=false || NOGOCHK=true
([ "${docker}" == "vaultwarden" ] || [ "${docker}" == "heimdall" ] || [ "${docker}" == "authelia" ]) && [ "${NTYPE}" == "WEB" ] && [[ $($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *${WEB_HOSTS[0]}* ]] && NOGOCHK=false || NOGOCHK=true
if [ ${NOGOCHK} == true ]; then
if [ "${ST_ACTION}" != "check" ]; then
if [ "${ST_ACTION}" != "report" ]; then

View File

@@ -451,6 +451,7 @@ SERVICE(){
fi
else
if [ "${4}" != "all" ]; then
for NTYPE in "${NODE_TYPES[@]}"; do
@@ -487,6 +488,10 @@ SERVICE(){
else
NTS=(${NODE_TYPES[*]})
fi
# if [ "${NODE_TYPE}" == "" ]; then
#
# fi
if [ "${3}" != "q" ]; then
if [ "${NM_SERVICES[${1}]}" = "" ]; then
@@ -509,7 +514,9 @@ SERVICE(){
fi
if [ "${1}" = "nginx" ] && [ "${NGINX_PATHS[${NODE_TYPE}]}" != "" ]; then
if [ "${1}" = "nginx" ]; then
[ "${NODE_TYPE}" != "" ] && [ "${NGINX_PATHS[${NODE_TYPE}]}" != "" ] &&
if [ "${2}" = "restart" ] || [ "${2}" = "reload" ]; then
if [ "${3}" != "ns" ]; then
if [ "${3}" != "q" ]; then
@@ -524,16 +531,11 @@ SERVICE(){
# ${PH_CMD} "echo -e \"Service ${1} ${2}\" >> ${NGINX_PATHS[${NODE_TYPE}]}/test.repl"
for nip in "${!NT_HOSTS}"; do
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then
if [ "${nip}" != "${!NT_HOST}" ]; then
checked=false
until [ "${checked}" = "true" ]; do
# checked="`${PH_CMD} \"ssh root@${nip} '[ -f ${NGINX_PATHS[${NODE_TYPE}]}/test.repl ] && cat -u ${NGINX_PATHS[${NODE_TYPE}]}/test.repl' | diff -q - ${NGINX_PATHS[${NODE_TYPE}]}/test.repl\"`"
# checked="`${PH_CMD} \"ssh root@${nip} '[ -f '${NGINX_PATHS[${NODE_TYPE}]}'/test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y '${NGINX_PATHS[${NODE_TYPE}]}'/test.repl)) -le 10 ] && echo true'\"`"
checked="`${PH_CMD} ssh root@${nip} [ -f ${NGINX_PATHS[${NODE_TYPE}]}/test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${NGINX_PATHS[${NODE_TYPE}]}/test.repl)) -le 90 ] && echo true`"
done
fi
if [ "${checkhost}" != "false" ] && [ "${nip}" != "${!NT_HOST}" ]; then
checked=false
until [ "${checked}" = "true" ]; do
checked="`${PH_CMD} ssh root@${nip} [ -f ${NGINX_PATHS[${NODE_TYPE}]}/test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${NGINX_PATHS[${NODE_TYPE}]}/test.repl)) -le 90 ] && echo true`"
done
fi
done
${PH_CMD} rm -f ${NGINX_PATHS[${NODE_TYPE}]}/test.repl