There are several plugins that show visitors a temporary message that your WordPress site is in maintenance mode, such as this plugin. It is a great plugin when you are developing the site or performing a temporary update, but these plugins will not help if your site goes down for any reason – they only work when the site is running properly. For when WordPress gets stuck in maintenance mode during updates, see how to fix WordPress maintenance mode.
In such cases it is worth preparing a permanent maintenance page on your server and redirecting visitors to it when your site goes down.
Add the following lines to your .htaccess file. Note that you need to change the address on line 3 to your IP so you can still access the site. Also change the page name and location according to your setup on line 3.
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_ADDR} !^123.123.123.123
RewriteRule $ /maintenance.html [R=302,L]