Use drush to put a site in maintenance mode drush @mysite cget system.maintenance shows:


  message: '@mysite is currently under maintenance. We should be back shortly. Thank you for your patience.'
      langcode: en


Drupal 8 uses state values to record transient state, so drush @mysite sget system.maintenance_mode gives me a 1 or a 0.

But, try as I may, I cannot see how to set the boolean. I've tried:

$ drush @mysite sset system.maintenance.mode "TRUE" --format=boolean
$ drush @mysite sget system.maintenance_mode
0
$ drush @mysite sset system.maintenance.mode "TRUE" --format=auto
$ drush @mysite sget system.maintenance_mode
0
$ drush @mysite sset system.maintenance.mode true --format=auto
$ drush @mysite sget system.maintenance_mode
0
$ drush @mysite sset system.maintenance.mode true --format=boolean
$ drush @mysite sget system.maintenance_mode 
0  


What's the secret?
system.maintenance_mode is not a boolean, it is an integer:

drush ev "var_dump(\Drupal::state()-&gt;get('system.maintenance_mode'));"


Result:

int(0)


The answer to the question, how to use drush to put a site in maintenance mode:

drush sset system.maintenance_mode 1