In maintenance mode, only site administrators can login and use the the site. When users try to access a course when your site is in maintenance mode, they will see a message informing them that the site is in maintenance mode. You can also create your own message.
To enable or disable maintenance mode in Moodle, navigate to
Settings > Site administration > Server > Maintenance mode