If you are running a devOps system, you can put your sites in maintenance mode like this, from Drupal 8 and onward:
drush sset system.maintenance_mode 1 drush cr
Important to not forget clearing cache afterward!
Buy me a drink 🍺