From b4871b873d843a9afae19ee7f0f2578cd9514147 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 1 Dec 2024 18:46:05 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 99023c56..00bd1492 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -780,18 +780,14 @@ RUN_COMMAND(){ done echo "NODETYPE1= '${nodetype}'" if [ "${nodetype}" == "ALL" ] || [ -z ${nodetype+x} ]; then - echo 1 nodetype=ALL NT_HOSTS=ALL_HOSTS[@] NTS=(${NM_NODE_TYPES[*]}) elif [ "${nodetype}" != "" ]; then - echo 2 if [ "${NM_HOSTS[${nodetype}]}" != "" ]; then - echo 3 NT_HOSTS=${nodetype}_HOSTS[@] NTS=("${nodetype}"); else - echo 4 echo -e "${idsCL[Red]}"${nodetype}" is an unknown NodeType.${idsCL[Default]}" exit 1 fi @@ -800,24 +796,24 @@ RUN_COMMAND(){ echo "NODETYPE2= '${nodetype}'" echo "RUNCMD= '${RUNCMD}'" - # for NTYPE in "${NTS[@]}"; do - # echo -e "${idsST[Bold]}"; DIVIDER - # echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}" - # DIVIDER; echo -e "${idsST[Reset]}" - # - # for nip in "${!NT_HOSTS}"; do - # if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost' - # else NCMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip}"; LH='' - # fi - # echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]}[${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYellow]}${LH}${idsCL[Default]}" - # DIVIDER false green - # echo "Running command: ${NCMD} ${RUNCMD}" - # #${NCMD} "${RUNCMD}" - # DIVIDER false green - # echo - # done - # echo - # done + for NTYPE in "${NTS[@]}"; do + echo -e "${idsST[Bold]}"; DIVIDER + echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}" + DIVIDER; echo -e "${idsST[Reset]}" + + for nip in "${!NT_HOSTS}"; do + if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost' + else NCMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip}"; LH='' + fi + echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]}[${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYellow]}${LH}${idsCL[Default]}" + DIVIDER false green + echo "Running command: ${NCMD} ${RUNCMD}" + #${NCMD} "${RUNCMD}" + DIVIDER false green + echo + done + echo + done } DOWNLIST(){