I have a situation where I am running multiple, multi-site setups. I have written a shell script to ease the use of drush.php in this instance. Maybe it will be of use to others, and if so, maybe it should be included with the module.

This script uses a single configuration directory, which contains a simple configuration file for each site you wish to use. This way i can simply specify the configuration by name, rather than needing to be in the correct directory, or specify a bunch of options.

The usage of the script is like this (i've named the script simply drush):
drush <configname> [drush options] <drush commands>
For instance, if you set up a config file named mysite.conf, you could do the following.
drush mysite cron
And as long as the drush shell script is in your PATH, this could be done from any directory.

There are 2 configurable paths in the script itself. First is for the php executable, and second is the directory containing the config files.

Here is an example configuration file, and i've attached the script.

# 
# Drush example configuration file.  
#
# Each configuration file declares the configuration for a single site.
# The name of the configuration file (without the extension) will be
# used when calling the drush script. For this file (example.conf), 
# drush would be invoked like such:
#   drush example [options] <command>
#
# IMPORTANT: Make sure there are no spaces before or after the = in the following declarations!

# base url of the site; include trailing slash
HOST=http://www.example.com/

# document root
ROOT=/var/www/html

# location of drush.php, relative to $ROOT
DRUSH=sites/all/modules/contrib/drush/drush.php
CommentFileSizeAuthor
drush shell script1.14 KBzroger

Comments

moshe weitzman’s picture

This looks pretty useful. The configuration of HOST should be optional since it can be specified in drushrc.php. Should we add something like this to the drush package? Feedback welcome.

mchelen’s picture

looks interesting, will give it a try, some functionality like this would be welcome :)

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

drush HEAD has vastly changed. Not sure if this is still useful. i think it is. This fanciness might be doable within a drushrc.php file.

adrian’s picture

Personally, I hate the --uri flag.

all my command have a validated parameter for the site it operates on.

ie:
provision cron site.com
provision backup site.com /path/to/tarball.tar.gz
provision restore site.com /path/to/tarball.tar.gz

pokadan’s picture

You might find www.drupalmashup.interestsphere.com useful

"This site comes to the aid of experienced Drupal developers who have discovered that they rely on much the same collection of modules for a particular type of site. Once you've mashed up your collection you can view the generated drush commands and/or download the (UNIX shell) script."

www.drupalmashup.interestsphere.com

moshe weitzman’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Not much interest, it seems.