From cd35b4c882102676cfe8a36f630661bf886d6fb6 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 23 Jan 2023 21:22:55 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index f3e21851..71f5d2b2 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -2051,13 +2051,16 @@ SINGLE_SERVER_SERVICE_CHECK(){ if [ -f /mnt/web-data/mounted ]; then for stc in "${services_to_check[@]}"; do if [ "$(systemctl is-active ${stc}.service)" != "active" ]; then + if [ "${EMAIL_NOTICE}" != "" ]; then echo -e "Starting ${stc} on ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} (${local_ip}), stopping on the other Nodes" | mail -s "Node-Balancing Notice" ${EMAIL_NOTICE}; fi + echo "$(date) - ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} - Starting ${stc} on ${local_ip}, stopping on the other Nodes" >> ${LOGFILE} + [ "${stc}" = "pdnsadmin" ] && stc="pdnsadmin.socket pdnsadmin.service" for nip in "${WEB_HOSTS[@]}"; do if [[ "${local_ip}" != *"${nip}"* ]]; then - echo "stopping ${stc} service on ${nip}" ssh root@${nip} /bin/systemctl stop ${stc} fi done + sleep 3s /bin/systemctl start ${stc} & fi done