2

Is there an easy way to take all sites in a multisite environment offline at the same time, in just one step? I really don't want to log in to each one and do it one at a time when I do something that involves all of them.

2 Answers 2

2

Assuming you have drush working, and have proper site aliases set up, the following should work:

drush @sites vset maintenance_mode 1

Turn take them all out, do

drush @sites vset maintenance_mode 0

If you are on Drupal 6, use site_offline instead of maintenance_mode.

2
  • I'm gonna set this up when I get a chance. Any good links for aliases?
    – DarkTygur
    Commented Feb 9, 2012 at 13:52
  • I did a quick search when I answered, but didn't see anything in the docs. You can copy drush/examples/example.aliases.drushrc.php to drush/aliases.drushrc.php and edit. The file is documented. Looking at on of my multisite servers, fully defined aliases may not be needed.
    – mpdonadio
    Commented Feb 9, 2012 at 14:10
2

If you have drush installed you could use this snippet:

#!/bin/bash
sites[0] = "http://www1.example.com";
sites[1] = "http://www2.example.com";
sites[2] = "http://www3.example.com";

for site in $sites; do
  drush vset --always-set --uri=$site site_offline 1 
done

I'm not an expert in sh scripting but something like that should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.