perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Gormley <cl...@traveljury.com>
Subject Re: double mod_perl initialization
Date Fri, 25 Sep 2009 17:48:35 GMT

> If I don't ever plan to use graceful restarts, and I believe that  
> smaller restart times are an unqualified Good, is there any reason why  
> I shouldn't ALWAYS use a script like the above? And is there any way  
> to avoid PerlModule modules from being loaded twice?

I do something pretty similar. I do the double load on 'start', single
load on 'restart', and I don't load the app on 'stop' / 'graceful-stop'.

I've altered apachectl to set $ENV{APACHE_MODE} to whatever 'command'
was given, eg  start / stop / restart etc.

Then my startup script looks like this:

----------------------------------------------------------------
my $apache_mode = $ENV{APACHE_MODE} || '';

die "'graceful-restart' is buggy. "
    . "Use 'apachectl graceful-stop; apachectl start' instead."
    if $apache_mode eq 'graceful-restart';

return 1
    if $apache_mode
        && ( $apache_mode eq 'restart'
             && Apache2::ServerUtil::restart_count() == 1
             || $apache_mode !~ /start/ );

setup_my_application();
----------------------------------------------------------------

There's only one small gotcha that I've found, and that occurs in this
situation:

 - apache isn't running
 - you do : apachectl restart
 - there is a compile time bug, and apache dies

The gotcha is that you don't get any STDERR or log output in this
situation.  However, you're only ever likely to encounter this in
development, and you soon recognise the issue.

clint


Mime
View raw message