Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-28 11:46:25 -06:00
parent 23883ac47c
commit b55b7845bc

View File

@@ -34,9 +34,15 @@ case "$1" in
nid=1
for nip in "${NODE_HOSTS[@]}"
do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost'
NCMD=''
else
NCMD="ssh root@${nip}"
fi
echo -en "${ADISP}ing Node ${nid} ($nip)...${idsCL[Default]}"
ssh root@${nip} systemctl $3 $2
if [[ $(is_service_running ${nip} ${2}) -gt "1" ]]; then
$NCMD systemctl $3 $2
if [[ $(${NCMD} pgrep mysql | wc -l) -gt "1" ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [ "$3" = "Stop" ]; then echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
else echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"