diff --git a/bin/cdist-mass-deploy b/bin/cdist-mass-deploy index f5790c03..f3e526cc 100755 --- a/bin/cdist-mass-deploy +++ b/bin/cdist-mass-deploy @@ -25,21 +25,22 @@ [ $# -ge 1 ] || __cdist_usage "[-p] [target host ...]" set -eu +parallel="" if [ "$1" = "-p" ]; then parallel=yes -else - parallel="" + shift fi while [ $# -ge 1 ]; do - if [ "$parallel" ]; then - cdist-deploy-to "$1" & - else - cdist-deploy-to "$1" - fi + # always assume we run parallel + cdist-deploy-to "$1" | awk -v host=$1 '{ print "[" host "]" $0 }"' & shift + + # if not, wait for it _now_ + [ "$parallel" ] || fg done +# else wait after all are started if [ "$parallel" ]; then echo "Waiting for cdist-deploy-to jobs to finish..." wait