Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-23 21:01:50 -06:00
parent d3e46ec3d2
commit 7fddb8ef04

View File

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