From a42a1fd675f79eecf25f34e6303e5e2551f7cb41 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 18 Oct 2023 15:56:22 -0500 Subject: [PATCH] update --- defaults.inc | 2 +- inc/services.inc | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/defaults.inc b/defaults.inc index 436c1bbe..6150eeb6 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ #!/usr/bin/env bash -VERS='4.12.35-10182023' +VERS='4.12.36-10182023' noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update ' CERT_DAEMON='/snap/bin/certbot' diff --git a/inc/services.inc b/inc/services.inc index 0b3129bc..44ed785a 100755 --- a/inc/services.inc +++ b/inc/services.inc @@ -13,25 +13,28 @@ SINGLE_SERVER_SERVICE_CHECK(){ SENDNOTICE "Node-Balancing Notice" "Starting SingleServer Services on ${NM_NODETYPES[${1^^}]}-Node${local_ip: -1} (${local_ip}), stopping on other Nodes" touch ${NM_TMPFOLDER}/.singleserver fi + gofor=false if [ "${1^^}" == "WEB" ] && [ ! -f /mnt/web-data/mounted ]; then /bin/mount -a sleep 5s + [ -f ${NM_REPL_CHECK_LOC["${1}-data"]}/mounted ] && gofor=true + else + gofor=true fi - if [ -f ${NM_REPL_CHECK_LOC["${1}-data"]}/mounted ]; then + if [ "${gofor}" == "true" ]; then for stc in "${!servicestocheck}"; do if [ "$(systemctl is-active ${stc}.service)" != "active" ]; then echo "$(date) - ${NM_NODETYPES[${1^^}]}-Node${local_ip: -1} - Starting ${stc} on ${local_ip}, stopping on the other Nodes ..." >> ${NM_LOGFILE} - [ "${stc}" = "pdnsadmin" ] && stc="pdnsadmin.socket pdnsadmin.service" + [ "${stc}" = "pdnsadmin" ] && stc="pdnsadmin.service pdnsadmin.socket" for nip in "${!hosts}"; do - if [[ "${local_ip}" != *"${nip}"* ]]; then - if [ "$(CHECK_HOST ${nip})" != "false" ]; then - ssh -tq root@${nip} /bin/systemctl stop ${stc} - ssh -tq root@${nip} rm -f ${NM_TMPFOLDER}/.singleserver - fi + if [[ "${local_ip}" != *"${nip}"* ]] && [ "$(CHECK_HOST ${nip})" != "false" ]; then + ssh -tq root@${nip} /bin/systemctl stop ${stc} + ssh -tq root@${nip} rm -f ${NM_TMPFOLDER}/.singleserver fi done sleep 3s + [ "${stc}" = "pdnsadmin" ] && stc="pdnsadmin.socket pdnsadmin.service" /bin/systemctl start ${stc} & echo "$(date) - ${NM_NODETYPES[${1^^}]}-Node${local_ip: -1} - ... Done" >> ${NM_LOGFILE} fi