From f71c1c6a77246586964fcd1ec3b9070fc9264fcd Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 1 Dec 2024 18:13:09 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 57 ++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 8cb4b49f..40646cae 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -771,31 +771,40 @@ BACKUP_UNIFINVR(){ } RUN_COMMAND(){ - echo "${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14}" - for NTYPE in "${NM_NODE_TYPES[@]}"; do - echo -e "${idsST[Bold]}"; DIVIDER - RUNCMD='' - for i in {1..14}; do - [ "${i}" != "1" ] && [ "${!i}" != "" ] && RUNCMD="${RUNCMD} " - [ "${!i}" != "" ] && RUNCMD="${RUNCMD}${!i}" - done - echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}" - DIVIDER; echo -e "${idsST[Reset]}" - - var=${NTYPE}_HOSTS[@] - for nip in "${!var}"; 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 + RUNCMD='' + while [ $# -gt 0 ]; do + case "${1}" in + -nt|-nodetype) nodetype=${2^^};; + *) RUNCMD="${1} ";; + esac + shift done + echo "${RUNCMD}" + + # for NTYPE in "${NM_NODE_TYPES[@]}"; do + # echo -e "${idsST[Bold]}"; DIVIDER + # RUNCMD='' + # for i in {1..14}; do + # [ "${i}" != "1" ] && [ "${!i}" != "" ] && RUNCMD="${RUNCMD} " + # [ "${!i}" != "" ] && RUNCMD="${RUNCMD}${!i}" + # done + # echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}" + # DIVIDER; echo -e "${idsST[Reset]}" + # + # var=${NTYPE}_HOSTS[@] + # for nip in "${!var}"; 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(){