[support] Manual DB Updates on Multisite

Ursula Pieper dramamezzo at gmail.com
Wed Apr 17 21:19:15 UTC 2013


I have a drush  alias file for all my sites (some multisite, some single
site, see http://drupal.org/node/670460).
I then use "drush alias updatedb" for all sites in a multisite installation
to make sure that all databases are updated.

(of course, I have a development multisite installation as well, so that I
can test the updates first).

"drush  site-alias"
gives you a list of all your aliases, so in principle, you could create
script like this:

#!/bin/bash
for site in `/usr/local/drush/drush site-alias`
do
  drush update
  drush updatedb
done
(I repeat the drush update for all sites, in case some of the modules are
not used by all sites)

However, that would update all your databases. Since I update develop
first, I actually have two update scripts:

#!/bin/bash
for site in "firstdev" "seconddev" "thirddev" "forthdev"
do
  echo "running updates for ${site}"
  /usr/local/drush/drush @${site} up
  /usr/local/drush/drush @${site} updatedb
  /usr/local/drush/drush @${site} cc all
done

(and then of course a second one for the production sites)

Hope this helps,

Ursula



On Wed, Apr 17, 2013 at 8:13 AM, John Summerfield <summer at js.id.au> wrote:

> On 17/04/13 20:33, Kenneth Jacker wrote:
> > Not sure what you mean here ...
> >
> > Use 'find' and the shell to do what?
> >
> >
> > Sorry if I'm being dumb/dense,
>
> [root at TestServer ~]# find /var/www/sites   -name settings.php
> /var/www/sites/testserver/sites/default/settings.php
> [root at TestServer ~]#
>
> The settings.php directories show which sites' databased need to be
> updated. I don't have multiple sites set up so it's hard to demonstrate.
>
> To work back a little,
> [root at TestServer ~]# find /var/www/sites   -name settings.php -exec
> dirname {} \;
> /var/www/sites/testserver/sites/default
> [root at TestServer ~]#
> When I set up multisites under D6, there were directories beside
> /var/www/sites/testserver/sites/default that reflected the domain names
> of the sites .
>
> I think that still works, but now there is also sites.php. If you can
> code in PHP (I can't really), then you can read that in PHP and work on
> the $sites array.
>
> This demonstrates making some sense of the sites.php from the commandline:
> [root at TestServer ~]# cat
> /var/www/sites/testserver/sites/example.sites.php  | awk '/\$sites\[/
> {if ($2 ~ ".sites") { printf "%s\t%s\t%s\t%s\n",  $1, $2, $3,$4}}'
> *       $sites['dev.drupal.org']        =       'example.com';
> *       $sites['localhost.example']     =       'example.com';
> *       $sites['8080.localhost.example']        =       'example.com';
> *       $sites['8080.www.drupal.org.mysite.test']       =
> 'example.com';
> [root at TestServer ~]#
>
> Note that in reality you would have "if ($1" etc, I used 2 here to test
> the second word to show the kind of output you should expect.
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130417/f247706a/attachment-0001.html 


More information about the support mailing list