So I have a folder for drush scripts _above_ several doc root folders on a dev user’s server. And I want to run status or whatever and my own custom drush scripts on _different_ Drupal web app instances. Drush has alias capability for different site instances, so you can do:
$ drush @site1 status
So, how to set up an aliases file?
(I’m on Ubuntu with Drush 6.2.0 installed with PEAR as per this great d.o. doc page Installing Drush on Any Linux Server Out There (Kalamuna people, wouldn’t you know it?)).
Careful reading of the excellent drush documentation points you to a Drush Shell Aliases doc page, and from there to the actual example aliases file that comes with every drush installation.
So to be able to run drush commands for a few of my local Drupal instances, I did this:
- In my Linux user directory, I created the file ~/.drush/aliases.drushrc.php
- Contents:
<?php $aliases['site1'] = array( 'root' => '/home/thevictor/site1/drupal-yii', 'uri' => 'drupal-yii.example.com', ); $aliases['site2'] = array( 'root' => '/home/thevictor/site2', 'uri' => 'site2.example.com', );
Then I can do, from anywhere as long as I am logged in as that user:
$ cd /tmp
$ drush @site1 status
...
$ drush @site2 status
and lots of other good stuff. Have a nice weekend.