diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 57b5497a..bc39d6b9 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -2042,10 +2042,26 @@ HAPROXY-CONFIG() { SINGLE_SERVER_SERVICE_CHECK(){ if [ "${1}" = "web" ]; then + servicestocheck=gitea,pdnsadmin + IFS=,; services_to_check=(${servicestocheck}); unset IFS + local_ips=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1); local_ip=$(/sbin/ip -o -4 addr list eth0 |grep 255 | awk '{print $4}' | cut -d/ -f1) if [[ ${local_ips} = *10.10.1.120* ]]; then if [ -f /mnt/web-data/mounted ]; then + for stc in "${services_to_check[@]}"; do + if [ "$(systemctl is-active stc).service" != "active" ]; then + [ "${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 + /bin/systemctl start gitea & + fi + done + if [ "$(systemctl is-active gitea)" != "active" ]; then for nip in "${WEB_HOSTS[@]}"; do if [[ "${local_ip}" != *"${nip}"* ]]; then