Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-23 20:49:49 -06:00
parent bc09df39a0
commit 7551012ccb

View File

@@ -2040,6 +2040,43 @@ HAPROXY-CONFIG() {
echo ""
}
SINGLE_SERVER_SERVICE_CHECK(){
if [ "${1}" = "web" ]; then
local_ips=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1);
loca_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
if [ "$(systemctl is-active gitea)" != "active" ]; then
for nip in "${WEB_HOSTS[@]}"; do
if [[ ${local_ip} != "${nip}" ]]; then
echo "stopping gitea service on ${nip}"
ssh root@${nip} /bin/systemctl stop gitea
fi
fi
/bin/systemctl start gitea &
fi
if [ "$(systemctl is-active pdnsadmin.service)" != "active" ]; then
for nip in "${WEB_HOSTS[@]}"; do
if [[ ${local_ip} != "${nip}" ]]; then
echo "stopping pdnsadmin service on ${nip}"
ssh root@${nip} /bin/systemctl stop pdnsadmin.service pdnsadmin.socket
fi
fi
/bin/systemctl start pdnsadmin.service pdnsadmin.socket &
fi
fi
else
/bin/systemctl stop gitea &
/bin/systemctl stop pdnsadmin.service pdnsadmin.socket &
fi
if [ "$(systemctl is-active nginx)" != "active" ]; then
/usr/local/bin/nodemgmt service web restart ${local_ip}
fi
fi
}
KEEPALIVE-CONFIG() {
echo -e "${idsCL[Yellow]}Creating Keepalive Config Files${idsCL[Default]}"
DIVIDER false yellow
@@ -2493,6 +2530,7 @@ if [ ${action-x} ]; then
SERVICE ${2} ${3} ${4}
fi;;
services) SERVICES;;
singleservercheck) SINGLE_SERVER_SERVICE_CHECK ${2} ${3};;
haproxy-config) HAPROXY-CONFIG;;
keepalive-config) KEEPALIVE-CONFIG;;
vc-ssl) VCENTER-SSL ${2};;