Practical mod_perl / HTML Book /



previous page: 5.8.3.1. Disabling code running under Apache::Registry
  
page up: HTML Version of the book
  
next page: 5.8.3.3. Disabling services with help from the frontend server

5.8.3.2. Disabling code running under other handlers


Under non-Apache::Registry handlers, you need to modify the configuration. You must either point all requests to a new location or replace the handler with one that will serve the requests during the maintenance period.

Example 5-2 illustrates a maintenance handler.

Example 5-2. Book/Maintenance.pm

package Book::Maintenance;

use strict;
use Apache::Constants qw(:common);

sub handler {
  my $r = shift;
  $r->send_http_header("text/plain");
  print qq{We regret that the service is temporarily
           unavailable while essential maintenance is undertaken.
           It is expected to be back online from 12:20 GMT.
           Please be patient. Thank you!};
  return OK;
}
1;

In practice, the maintenance script may well read the "back online" time from a variable set with a PerlSetVar directive in httpd.conf, so the script itself need never be changed.

Edit httpd.conf and change the handler line from:

<Location /perl>
    SetHandler perl-script
    PerlHandler Book::Handler
    ...
</Location>

to:

<Location /perl>
    SetHandler perl-script
    #PerlHandler Book::Handler
    PerlHandler Book::Maintenance
    ...
</Location>

Now restart the server. Users will be happy to read their email for 10 minutes, knowing that they will return to a much improved service.

 

Continue to:

  • prev: 5.8.3.1. Disabling code running under Apache::Registry
  • Table of Contents
  • next: 5.8.3.3. Disabling services with help from the frontend server







TOP
previous page: 5.8.3.1. Disabling code running under Apache::Registry
  
page up: HTML Version of the book
  
next page: 5.8.3.3. Disabling services with help from the frontend server


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com