Categories
Drupal Tips & Tricks

Drush aliases and Multi-Site

As a Drupal administrator, Drush aliases is a tool I cannot live without. It provides a way for me to connect to any Drupal site on any environment and run drush commands. The only requirement is that I have SSH access to those servers.

Anyone who has worked with Drush and Drupal multi-site should be aware of the @sites shortcut, which allows you to run Drush commands on all your sites as a single command. However, the @sites shortcut is the same format as the Drush remote alias format, @example, which causes Drush to not recognize the multi-site shortcut. So for instance:

$ drush @example.prod @sites cache-clear all

Won’t work. Instead use the following simple fix:

$ drush @example.prod "@sites cache-clear all"

And now Drush will pass everything within the quotes to the remote server.

Hope this helps!!

Update: Due to a bug with how the uri is passed to SSH, you will need to use the latest dev version of Drush 7