From b9ef12b48d20c284e3cbf986f7ba4ec824a7ee81 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 6 Apr 2011 14:05:47 +0200 Subject: [PATCH] enhance cdist-mass-deploy and add parallel execution Signed-off-by: Nico Schottelius --- bin/cdist-mass-deploy | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/cdist-mass-deploy b/bin/cdist-mass-deploy index 84e4376d..f5790c03 100755 --- a/bin/cdist-mass-deploy +++ b/bin/cdist-mass-deploy @@ -22,10 +22,25 @@ # . cdist-config -[ $# -ge 1 ] || __cdist_usage " [target host ...]" +[ $# -ge 1 ] || __cdist_usage "[-p] [target host ...]" set -eu +if [ "$1" = "-p" ]; then + parallel=yes +else + parallel="" +fi + while [ $# -ge 1 ]; do - cdist-deploy-to "$1" + if [ "$parallel" ]; then + cdist-deploy-to "$1" & + else + cdist-deploy-to "$1" + fi shift done + +if [ "$parallel" ]; then + echo "Waiting for cdist-deploy-to jobs to finish..." + wait +fi