Download & Extend

Run Drush commands on all sites in multi-site install

Project:Drush
Version:All-versions-5.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

It would be good to have the built in ability to run drush commands on all sites in a multi-site install. Obvious this would be useful for updating security fixes for modules, but also for getting info like which modules are enabled where.

I have written a bash script for this (attached), I can have a go at re-doing it in php.

AttachmentSize
drush_multi.sh_.txt1.12 KB

Comments

#1

Wonderful! We, too, run Drush on all our multisites along with our Cron jobs, non-verbosely. For more control (and because we end some sites with -com and some with -org), we call up the sites via .txt files. Attached is our method, though I don't know much Bash so it is VERY basic (therefore easy to understand to other less bashful people).

I suppose an added advantage would be to run with verbosity and save the results in a text file; instead, every now and then I run the file manually to see if there are errors.

Somebody talk me out of this....

#!/bin/sh -x

# Section 1
        echo "Starting Cron Jobs"
#DRUPAL CRON JOBS
        for i in `egrep -v '#' /usr/local/www/webroots/drupalcron-domains.txt`; \
        do /usr/local/bin/wget --quiet -O - -t 1 http://www.$i/cron.php; \
        done
        echo "Finished Cron Jobs"

# Section 2
        echo "Starting Updates"
#DRUPAL UPDATE JOBS
   #.COM DOMAINS
        for i in `egrep -v '#' /usr/local/www/webroots/drush-com.txt`; \
        do cd /usr/local/www/webroots/$i-com; \
        drush --q  --uri=http://$i.com updatedb; \
        done
        echo "Com Domains Updated"

   #.ORG DOMAINS
        for i in `egrep -v '#' /usr/local/www/webroots/drush-org.txt`; \
        do cd /usr/local/www/webroots/$i-org;  \
        drush --q  --uri=http://$i.org updatedb; \
        done
        echo "Org Domains Updated"

#2

In shell scripts, you can check for exit codes, so

......
do
  /usr/local/bin/wget --quiet -O - -t 1 http://www.$i/cron.php
  if [ $? -ne "0" ]; then
    echo "uhoh, wget failed for $i"
  fi
done
.....

Write the script so that it only outputs when there is a problem. If the script is running on crontab the output can be emailed.

So no errors = no email

#3

I also would like this feature very much. I think in our case it would also be a noticeable speed improvement if the loop over the projects would be done from php instead of calling the script from the outside (we have over 3000 sites).

#4

Subscribe. This would be so handy for upgrading our multisite installs.

#5

Just found a new drush module thats trying to work with multisite installs http://drupal.org/project/drush_multi

Surely this could just be a command line option?

#6

I'm planning on supporting multiple-site commands as an extension to drush site aliases. See #628996: Concurrently execute a single drush command on multiple sites. I didn't notice this incident when I created that one; one or the other of these could be closed as a duplicate.

#7

Status:active» closed (duplicate)

Greg, I reckon your issue covers this one and more. Marking as a duplicate. #628996: Concurrently execute a single drush command on multiple sites