From 7086cef484249c17df510d02acd4128244a8745f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Fri, 6 Dec 2024 22:19:01 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 739b0e19..47463d8b 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -801,18 +801,28 @@ RUN_COMMAND(){ DIVIDER; echo -e "${idsST[Reset]}" NT_HOSTS=${NTYPE}_HOSTS[@] 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}" + if [ ! -f /tmp/nmg.run.${nip} ]; then + if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then + NCMD='' + LH='- localhost' + else + NCMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip}" + LH='' + fi + # echo "Running command: ${NCMD} ${RUNCMD}" + ${NCMD} "${RUNCMD}" + touch /tmp/nmg.run.${nip} + else + echo "Skipping, already ran command on this host" + fi DIVIDER false green echo done echo done + rm -f /tmp/nmg.run.* } DOWNLIST(){