Drush and Maintenance Mode

We love Drupal here at Ferlito/van Der Wyk, but as soon as we get accustomed to a certain way of doing things with Drupal, it changes. Here's one example: using Drush to put a site into maintenance mode. This drush command puts a site into maintenance mode:


drush vset site_offline 1 --always-set

and putting it back online is just as easy:


drush vset site_offline 0 --always-set

This works great for Drupal 6, but the good folks at Drupal decided to change things up for D7. We are now using a new variable, maintenance_mode. A value of 1 indicates the site is in maintenance mode, so for D7 we have this:


drush vset maintenance_mode 1

and to put it back online you need two commands:


drush vset maintenance_mode 0
drush cc all

Don't forget to do both commands or it won't work, the second one clears caches.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.