Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-23 21:22:55 -06:00
parent bae3e43226
commit cd35b4c882

View File

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