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(){