Created
June 8, 2012 02:03
-
-
Save gerhard/2893008 to your computer and use it in GitHub Desktop.
Parallelize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__parallelize() { | |
local _task="$1" | |
local _hosts="${2:-"$SERVERS_APP_USER"}" | |
background_task_pids=() | |
background_tasks=() | |
for _host in $_hosts | |
do | |
( eval "$_task" ) & | |
background_task_pids+=("$!") | |
local _logged_task="$(eval echo \"$_task\")" | |
echo "$_logged_task" | |
background_tasks+=("$_logged_task") | |
done | |
__monitor_background_tasks | |
} | |
git_push() { | |
__parallelize "git push -f \$_host $BRANCH" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment