Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-27 21:57:48 -06:00
parent fb724a5fbd
commit 4a6e8672d6

View File

@@ -79,31 +79,17 @@ case "$1" in
STA="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"
echo -e "${idsCL[LightGreen]}[[${SER} ${STA}ing]]${idsCL[Default]}"
for i in "${node_hosts[@]}"
nid=1
for nip in "${node_hosts[@]}"
do
echo "Here: ${i}"
echo -en "${idsCL[Cyan]}${STA}ing Node ${nid}...${idsCL[Default]}"
ssh root@${nip} systemctl $3 $2
if [[ $(ssh root@${nip} ps -ef | grep -c ${2}) -ne 1 ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
else echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
nid=`expr $nid + 1`
done
echo -en "${idsCL[Cyan]}${STA}ing Node 1...${idsCL[Default]}"
ssh root@10.5.10.51 systemctl $3 $2
if [[ $(ssh root@10.5.10.51 ps -ef | grep -c ${2}) -ne 1 ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
else echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
echo -en "${idsCL[Cyan]}${STA}ing Node 2...${idsCL[Default]}"
ssh root@10.5.10.52 systemctl $3 $2
if [[ $(ssh root@10.5.10.52 ps -ef | grep -c ${2}) -ne 1 ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
else echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
echo -en "${idsCL[Cyan]}${STA}ing Node 3...${idsCL[Default]}"
ssh root@10.5.10.53 systemctl $3 $2
if [[ $(ssh root@10.5.10.53 ps -ef | grep -c ${2}) -ne 1 ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
else echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
echo ""
echo -e "${idsCL[Green]}${SER} has been ${STA}ed${idsCL[Default]}"