Drupal – Drush Command Concurrency

Drush supports many ways of specifying local and remote sites using site-aliases. There is also a method to support a group of site aliases and a generic multi-site identifier when issuing commands.

Given a site alias of @dev to dev-site.example I could issue the following Drush command from anywhere on my system (not just the Drupal webroot for dev-site):

drush @dev cc all;

If I were to define a group of site aliases as follows I could issue the command once from my shell and have it run sequentially on each site specified:

drush @dev-sites cc all;

A group site alias is defined as follows, it has aliases but no uri attribute:

$options['site-aliases']['all-dev'] = array(
  'group' => array( 'dev.site1.com', 'dev.site2.com', 'dev.site3.com')

If I had a large list of sites in my group I could even adjust the concurrency level of the command by passing a –concurrency option:

drush @dev-sites cc all –concurrency=6;

Lastly, a general alias for all sites knowable by Drush could be used as a simple means to run a command everywhere possible. This is the @sites placeholder:

drush @sites cc all;

Whether you run 1 site locally. Host a small number of websites, or many distributed websites across many servers — these options should help you to tweak and better make use of Drush commands.

Looking for quality Drupal Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , | Posted under Drupal, Drush | RSS 2.0

Author Spotlight

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at david.gurba@arvixe.com

Leave a Reply

Your email address will not be published. Required fields are marked *