From 98f7905c66f7a8ededea5abdb6fae8c37f5572a8 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 27 Jan 2019 21:17:38 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 0c4c6331..9b7f022a 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -77,12 +77,27 @@ case "$1" in #fi STA="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}" echo -e "${idsCL[LightBlue]}[[${SER} ${STA}ing]]${idsCL[Default]}" - echo -e "${idsCL[Cyan]}${STA}ing Node 1...${idsCL[Default]}" + + echo -en "${idsCL[Cyan]}${STA}ing Node 1...${idsCL[Default]}" ssh root@10.5.10.51 systemctl $3 $2 - echo -e "${idsCL[Cyan]}${STA}ing Node 2...${idsCL[Default]}" + if [[ $(ssh root@10.5.10.51 ps -ef | grep -c xyz) -ne 1 ]]; then + echo -en "${idsCL[Cyan]}${STA}ing Node 1... ${idsCL[Green]}OK${idsCL[Default]}" + else echo -en "${idsCL[Cyan]}${STA}ing Node 1... ${idsCL[Red]}ERROR${idsCL[Default]}" + fi + + echo -en "${idsCL[Cyan]}${STA}ing Node 3...${idsCL[Default]}" ssh root@10.5.10.52 systemctl $3 $2 - echo -e "${idsCL[Cyan]}${STA}ing Node 3...${idsCL[Default]}" + if [[ $(ssh root@10.5.10.52 ps -ef | grep -c xyz) -ne 1 ]]; then + echo -en "${idsCL[Cyan]}${STA}ing Node 1... ${idsCL[Green]}OK${idsCL[Default]}" + else echo -en "${idsCL[Cyan]}${STA}ing Node 1... ${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 xyz) -ne 1 ]]; then + echo -en "${idsCL[Cyan]}${STA}ing Node 1... ${idsCL[Green]}OK${idsCL[Default]}" + else echo -en "${idsCL[Cyan]}${STA}ing Node 1... ${idsCL[Red]}ERROR${idsCL[Default]}" + fi echo -e "${idsCL[Green]}${SER} has been ${STA}ed${idsCL[Default]}" exit 0 ;;