Skip to content

Instantly share code, notes, and snippets.

@benclark
Created June 9, 2015 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benclark/70a802c015ce74d610e3 to your computer and use it in GitHub Desktop.
Save benclark/70a802c015ce74d610e3 to your computer and use it in GitHub Desktop.
Run drush updb in parallel in groups of 5
#!/bin/sh
#
# Run `drush updb` in parallel in groups of 5.
#
# The for loop is populated by running `drush sa`, but this could also be a
# file with aliases on each line.
#
# The
i=0
for site in $(drush sa); do
echo "---- $site"
nohup drush @$site updb -y < /dev/null > $HOME/drush-updb.$site.log 2>&1 &
i=$((i+1))
if [ 0 -eq $((i%5)) ]; then
wait
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment