Solved

How to make a maintenance page during the outage?

Posted on 2012-03-26
9
615 Views
Last Modified: 2013-12-02
During the mainteance, upgrades, and outages.  How to point users to the page shows 'Sorry the system is on maintenance, please be patient'
What's the way to do that? Do I need to redirect via DNS that takes hours to propagate and back?  I never done that before. Please advise.
Thanks.
0
Comment
Question by:Tiras25
  • 2
  • 2
  • 2
  • +1
9 Comments
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 200 total points
ID: 37771036
No, DNS propagation is not the way to go.  Presumably you have a common script that is used to start every web page.  (If you do not, this is the right time to set it up.)  That script is the place to put information about maintenance.  Here is an example using the PHP scripting language; the same principles apply to other languages, too.

Every script on the site starts with this
<?php require_once('common.php');

Open in new window

Then when you are ready to perform maintenance, you flip on a maintenance switch that redirects the client browser like this
<?php // common.php
error_reporting(E_ALL);


// DEMONSTRATE HOW TO REDIRECT EVERYTHING TO THE MAINTENANCE SCRIPT


// THE NORMAL SETTING
$maintenance=FALSE;

// THE DEMONSTRATION SETTING
// $maintenance=TRUE;

// IF MAINTENANCE IS IN PLAY
if ($maintenance)
{
    // CONSTRUCT THE URL WE WANT
    $my_uri
    = '/maintenance.html'
    . '?'
    . $_SERVER["QUERY_STRING"]
    ;

    // BAIL OUT WITH AUTOMATIC 302 AND LOCATION
    header("Location: $my_uri");
    exit;
}

// MAINTENANCE IS NOT IN PLAY - START THE NORMAL SCRIPTS HERE

Open in new window

And just for demonstration purposes, here is a page that will get loaded if the maintenance is underway
<h1>Maintenance</h1>

Open in new window

You may need to generate a 302 header yourself; if you are using PHP the 302 header is generated automatically by header("Location").

HTH, ~Ray
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 200 total points
ID: 37771047
0
 
LVL 16

Assisted Solution

by:Rose Babu
Rose Babu earned 100 total points
ID: 37771051
use App_Offline.htm file with some maintenance content/design in your website root.

it will restrict all access to the website.

after you have updated your files then you can delete this file.

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

Try this.
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 17

Author Comment

by:Tiras25
ID: 37772323
We are using a Tomcat.  Are these instruction applicable to any environment?
0
 
LVL 27

Assisted Solution

by:mrcoffee365
mrcoffee365 earned 200 total points
ID: 37834416
It depends a lot on your physical as well as network setup.

You're right, pointing DNS to a different machine is one way to go.  

If this is scheduled maintenance and you want to change the DNS pointer to a different machine, about 24 hours before the maintenance change your time-to-live on the DNS entry to a very small amount -- 15 minutes can be good.  On the maintenance day, 30 minutes before the downtime, change the time-to-live to 1 minute.  At downtime, change your DNS to point to a different IP address, where there's a simple web server configured to respond with a single page.  Change DNS time-to-live back to whatever the normal amount is after your maintenance is over and you are returning to your normal IP address.

If you are not taking down the whole machine, and it's okay for it to still serve pages, then you can have a small Tomcat or Apache instance which you switch on for maintenance.  It just has one page, which says you're down for maintenance.

A lot of companies have a router which they can change to point to a different machine internally when a request from outside comes in for the Web server IP address.  The different machine can have a small Web server and simple maintenance page.  Externally you don't change DNS entries -- you don't change anything externally.  If you can do it, this is a fast way to handle maintenance.

Some people have a maintenance webapp under Tomcat.  In that case, Tomcat is still running, but the webapp you don't want running doesn't answer on 80 any more.  Usually that means changing server.xml, then stopping and starting Tomcat.

It all depends on your physical and network layout and what you find easiest.

Ray Paseur's first answer was most similar to my last one for Tomcat.  In his answer, the web server had to still be running and answering on the IP address, and the main PHP app had to be switched out for the maintenance one.
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38273999
I read your solutions again.
Which of these solutions still work if the entire environment is in maintenance? #1 I guess is technically feasible. The TTL solution I guess works but seems messy.
0
 
LVL 27

Assisted Solution

by:mrcoffee365
mrcoffee365 earned 200 total points
ID: 38278623
Have you actually tried any of these?  Why don't you test a few of the solutions and see if they do what you want.  You can ask questions about them if you have more questions.

>>Which of these solutions still work if the entire environment is in maintenance?
It depends, of course, on what you consider your entire environment.  Try asking a specific question and perhaps we can help.  Or as I mentioned above, try some of these and see if they do what you want.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question