Solved

How to make a maintenance page during the outage?

Posted on 2012-03-26
9
613 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 108

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 108

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
The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

 
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

Does Powershell have you tied up in knots?

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

929 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now