From 5cfcccdc05cfa7475cf1b432f6fcb2820fc9fea8 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 17 Oct 2023 23:24:14 -0500 Subject: [PATCH] Update services.inc --- inc/services.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/services.inc b/inc/services.inc index 1c819a8f..22dc660f 100755 --- a/inc/services.inc +++ b/inc/services.inc @@ -8,9 +8,9 @@ SINGLE_SERVER_SERVICE_CHECK(){ if [ "${!servicestocheck}" != "" ] || [ "${!dockerstocheck}" != "" ]; then local_ips=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | 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 [[ ${local_ips} == *${NM_SINGLESRVR_IP[${1^^}]}* ]]; then if [ ! -f ${NM_TMPFOLDER}/.singleserver ]; then - SENDNOTICE "Node-Balancing Notice" "Starting SingleServer Services on ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} (${local_ip}), stopping on other Nodes" + 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 if [ ! -f /mnt/web-data/mounted ]; then @@ -20,7 +20,7 @@ SINGLE_SERVER_SERVICE_CHECK(){ if [ -f ${NM_REPL_CHECK_LOC["${1}-data"]}/mounted ]; then for stc in "${!servicestocheck}"; do if [ "$(systemctl is-active ${stc}.service)" != "active" ]; then - echo "$(date) - ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} - Starting ${stc} on ${local_ip}, stopping on the other Nodes" >> ${NM_LOGFILE} + 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" for nip in "${!hosts}"; do @@ -236,7 +236,7 @@ SERVICE(){ ${PH_CMD} rm -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl fi fi - elif ([ "${1}" = "pdns" ] || [ "${1}" = "pdnsadmin" ]) && ([ "${3}" == "" ] || [ "${3}" == "all" ]); then + elif ([ "${1}" = "pdns" ] || [ "${1}" = "pdnsadmin" ] || [ "${1}" = "headscale" ]) && ([ "${3}" == "" ] || [ "${3}" == "all" ]); then if [ "${2}" = "start" ] || [ "${2}" = "restart" ] || [ "${2}" = "reload" ]; then if [ "${3}" != "ns" ]; then if [ "${3}" != "q" ]; then