Update nodemgmt-scripts.sh
This commit is contained in:
@@ -1205,81 +1205,35 @@ SERVICE(){
|
||||
echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${1}]} ${NM_SRVCOPTS[${2}]}ing]]${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
|
||||
|
||||
if [[ "${MYSQLSERVICES_CHECK}" = *"${1}"* ]]; then
|
||||
nid=1
|
||||
for nip in "${MYSQL_HOSTS[@]}"; do
|
||||
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
NCMD="ssh root@${nip}"
|
||||
fi
|
||||
echo -en "${NM_SRVCOPTS[${2}]}ing on MySQL-Node${nid} ($nip)... ${idsCL[Default]}"
|
||||
if [ "$1" = "gitea" ] && [ "$2" = "restart" ]; then
|
||||
$NCMD systemctl stop $1
|
||||
SET-PERMISSIONS gitea
|
||||
$NCMD systemctl start $1
|
||||
else
|
||||
|
||||
for NTYPE in "${NODE_TYPES[@]}"; do
|
||||
var1=${NTYPE}SERVICES_CHECK
|
||||
if [[ "${!var}" = *"${1}"* ]]; then
|
||||
nid=1
|
||||
var=${NTYPE}_HOSTS[@]
|
||||
for nip in "${!var}"; do
|
||||
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
NCMD="ssh root@${nip}"
|
||||
fi
|
||||
echo -en "${NM_SRVCOPTS[${2}]}ing on ${NM_NODETYPES[$NTYPE]}-Node${nid} ($nip)... ${idsCL[Default]}"
|
||||
$NCMD systemctl $2 $1
|
||||
fi
|
||||
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$2" = "stop" ]; then
|
||||
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
|
||||
else
|
||||
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
|
||||
fi
|
||||
nid=`expr $nid + 1`
|
||||
done
|
||||
fi
|
||||
if [[ "${WEBSERVICES_CHECK}" = *"${1}"* ]]; then
|
||||
nid=1
|
||||
for nip in "${WEB_HOSTS[@]}"; do
|
||||
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
NCMD="ssh root@${nip}"
|
||||
fi
|
||||
echo -en "${NM_SRVCOPTS[${2}]}ing on Webserver-Node${nid} ($nip)... ${idsCL[Default]}"
|
||||
$NCMD systemctl $2 $1
|
||||
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$2" = "stop" ]; then
|
||||
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
|
||||
else
|
||||
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
|
||||
fi
|
||||
nid=`expr $nid + 1`
|
||||
done
|
||||
fi
|
||||
if [[ "${LBSERVICES_CHECK}" = *"${1}"* ]]; then
|
||||
nid=1
|
||||
for nip in "${LB_HOSTS[@]}"; do
|
||||
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
NCMD="ssh root@${nip}"
|
||||
fi
|
||||
echo -en "${NM_SRVCOPTS[${2}]}ing on LB-Node${nid} ($nip)... ${idsCL[Default]}"
|
||||
$NCMD systemctl $2 $1
|
||||
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$2" = "stop" ]; then
|
||||
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
|
||||
else
|
||||
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
|
||||
fi
|
||||
nid=`expr $nid + 1`
|
||||
done
|
||||
fi
|
||||
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
elif [ "$2" = "stop" ]; then
|
||||
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
|
||||
else
|
||||
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
|
||||
fi
|
||||
nid=`expr $nid + 1`
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Green]}${NM_SERVICES[${1}]} has been ${NM_SRVCOPTS[${2}]}ed${idsCL[Default]}"
|
||||
@@ -1508,7 +1462,14 @@ if [ ${action-x} ]; then
|
||||
status) STATUS ${2};;
|
||||
status-check) STATUS-CHECK ${2};;
|
||||
set-permissions) SET-PERMISSIONS ${2};;
|
||||
service) SERVICE ${2} ${3};;
|
||||
service)
|
||||
if [ "$2" = "gitea" ] && [ "$3" = "restart" ]; then
|
||||
SERVICE gitea stop
|
||||
SET-PERMISSIONS gitea
|
||||
SERVICE gitea start
|
||||
else
|
||||
SERVICE ${2} ${3}
|
||||
fi;;
|
||||
services) SERVICES;;
|
||||
haproxy-config) HAPROXY-CONFIG;;
|
||||
keepalive-config) KEEPALIVE-CONFIG;;
|
||||
|
||||
Reference in New Issue
Block a user