Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created June 8, 2012 02:03
Show Gist options
  • Save gerhard/2893008 to your computer and use it in GitHub Desktop.
Save gerhard/2893008 to your computer and use it in GitHub Desktop.
Parallelize
__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