Drupal allows a restrict set of users to access the site when maintenance tasks run: the maintenance mode.

When the maintenance mode is enabled, only users with the "use the site in maintenance mode" permission are able to access your site to perform maintenance; all other visitors see the maintenance mode message configured in the setting page. Authorized users can log in directly via the user login page.