diff --git a/dsmon.sh b/dsmon.sh index d9011c3..bac203a 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -353,20 +353,21 @@ RUNCMD(){ nc_count=0; completed=false until [ "${completed}" == "true" ]; do for nodecmd in /tmp/.dsmon.runcmd.*.done; do - # HOST=$(grep -oP '(?<=runcmd.).*?(?=.done)' <<< "${nodecmd}") - # if [ "${HOST}" != "*" ]; then - # if [[ "${nodecmd}" != *"*"* ]]; then - # nodecmd_output=$(cat ${nodecmd}) - # [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n" - # fi - # rm -f ${nodecmd} + HOST=$(grep -oP '(?<=runcmd.).*?(?=.done)' <<< "${nodecmd}") + if [ "${HOST}" != "*" ]; then if [[ "${nodecmd}" != *"*"* ]]; then - echo ${nodecmd} + nodecmd_output=$(cat ${nodecmd}) + [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n" + fi + rm -f ${nodecmd} + + if [[ "${nodecmd}" != *"*"* ]]; then + nodecmd_output=$(cat ${nodecmd}) + [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n" rm -f ${nodecmd} ((nc_count++)) fi done - echo "${ncount} - ${nc_count}\n" if [ ${nc_count} -eq ${ncount} ]; then completed=true break