This commit is contained in:
2023-10-18 15:56:22 -05:00
parent 324162e009
commit a42a1fd675
2 changed files with 11 additions and 8 deletions

View File

@@ -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'

View File

@@ -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