This commit is contained in:
2024-11-17 15:30:21 -06:00
parent aec08a1bad
commit 1458a0eb35
2 changed files with 6 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERS='5.3.1-11132024' VERS='5.3.2-11172024'
NM_BETA=false NM_BETA=false
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update log betacheck offsite-staticroute-fix ' noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update log betacheck offsite-staticroute-fix '

View File

@@ -5,13 +5,13 @@ SINGLE_SERVER_SERVICE_CHECK(){
dockerstocheck=${1^^}_SINGLESRVR_DOCKERS[@] dockerstocheck=${1^^}_SINGLESRVR_DOCKERS[@]
hosts=${1^^}_HOSTS[@] hosts=${1^^}_HOSTS[@]
[ "${2^^}" == "START" ] && rm -f ${NM_TMPFOLDER}/.singleserver [ "${2^^}" == "START" ] && rm -f ${NM_TMPFOLDER}/.singleserver.${1^^}
if [[ "$(declare -p ${1^^}_SINGLESRVR_SERVICES)" =~ "declare -a" ]] || [[ "$(declare -p ${1^^}_SINGLESRVR_DOCKERS)" =~ "declare -a" ]]; then if [[ "$(declare -p ${1^^}_SINGLESRVR_SERVICES)" =~ "declare -a" ]] || [[ "$(declare -p ${1^^}_SINGLESRVR_DOCKERS)" =~ "declare -a" ]]; then
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1) == *${NM_SINGLESRVR_IP[${1^^}]}* ]]; then if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1) == *${NM_SINGLESRVR_IP[${1^^}]}* ]]; then
if [ ! -f ${NM_TMPFOLDER}/.singleserver ]; then if [ ! -f ${NM_TMPFOLDER}/.singleserver.${1^^} ]; then
SENDNOTICE "Node-Balancing Notice" "Starting SingleServer Services on ${NM_HOSTNAMES[${RUN_NODE_IP}]} (${RUN_NODE_IP}), stopping on other Nodes" SENDNOTICE "Node-Balancing Notice" "Starting SingleServer Services on ${NM_HOSTNAMES[${RUN_NODE_IP}]} (${RUN_NODE_IP}), stopping on other Nodes"
touch ${NM_TMPFOLDER}/.singleserver touch ${NM_TMPFOLDER}/.singleserver.${1^^}
fi fi
gofor=false gofor=false
if [ "${1^^}" == "WEBxx" ] && [ ! -f ${NM_REPL_CHECK_LOC['web-data']}/mounted ]; then if [ "${1^^}" == "WEBxx" ] && [ ! -f ${NM_REPL_CHECK_LOC['web-data']}/mounted ]; then
@@ -30,7 +30,7 @@ SINGLE_SERVER_SERVICE_CHECK(){
for nip in "${!hosts}"; do for nip in "${!hosts}"; do
if [[ "${RUN_NODE_IP}" != *"${nip}"* ]] && [ "$(CHECK_HOST ${nip})" != "false" ]; then if [[ "${RUN_NODE_IP}" != *"${nip}"* ]] && [ "$(CHECK_HOST ${nip})" != "false" ]; then
ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} /bin/systemctl stop ${stc} ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} /bin/systemctl stop ${stc}
ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} rm -f ${NM_TMPFOLDER}/.singleserver ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} rm -f ${NM_TMPFOLDER}/.singleserver.${1^^}
fi fi
done done
sleep 3s sleep 3s
@@ -71,7 +71,7 @@ SINGLE_SERVER_SERVICE_CHECK(){
for docker in "${!dockerstocheck}"; do for docker in "${!dockerstocheck}"; do
[ "$(/usr/bin/docker ps -q -f name=${docker})" ] && /usr/bin/docker stop ${docker} & >/dev/null 2>&1 [ "$(/usr/bin/docker ps -q -f name=${docker})" ] && /usr/bin/docker stop ${docker} & >/dev/null 2>&1
done done
rm -f ${NM_TMPFOLDER}/.singleserver rm -f ${NM_TMPFOLDER}/.singleserver.${1^^}
fi fi
[ "${1^^}" == "WEB" ] && [ "$(systemctl is-active nginx)" != "active" ] && ${NM_SCRIPT} service web restart ${RUN_NODE_IP} [ "${1^^}" == "WEB" ] && [ "$(systemctl is-active nginx)" != "active" ] && ${NM_SCRIPT} service web restart ${RUN_NODE_IP}