You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Clinton Gormley <cl...@traveljury.com> on 2006/08/16 19:24:12 UTC

Output from apache during startup

I have a homegrown framework which I use for my webapps (Perrin, it's
like the others, but faster!! and lighter!! and will be on CPAN any day
now... or something like that)

The framework does quite a lot of work setting up the applications that
depend on it, and one of the things it does is autoconfigures the
virtual hosts that the application requires.

The setup needs to be called from a PerlConfigHandler, otherwise it is
too late to set up the virtual hosts --> segfaults.

It optionally outputs a fair bit of information about what it has set
up, which goes to STDOUT.

The problem is this:

WHEN restart_count==1
 - you see all the setup information, but it sets everything up even
   when you use 'apachectl stop'
 - the setup gets dumped when apache restarts, so it doesn't work anyway

WHEN restart_count!=1
 - setup happens only when it should, but you don't see any of the
   startup info.
 - if I print the startup info to STDERR instead of STDOUT, then you
   don't see anything on 'apachectl start', but you do on 
   'apachectl restart'
 - 'apachectl -S'  gives no information about what virtual servers have
   been set up

SO, ideally, I would like to do this:
 - apachectl start : set it up twice, as it should be, so that it checks
   that apachectl graceful will work.  see the output once
 - apachectl restart : see the output once
 - apachectl stop : do not have it parse my setup

Any ideas how I could proceed with this? Should I be catching a
'SIGTERM' and turning off setup in that situation?

or is there just no way of detecting that this is a 'stop'?

The only other thing I've though of is doing something like:
apachectl -Dfast stop/start/restart

And if -Dfast is set, then only do the setup when restart_count!=1

many thanks

clint

________________________________________________________________________

Clinton Gormley clinton@traveljury.com

www.TravelJury.com - For travellers, By travellers




Re: Output from apache during startup

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2006-08-16 at 19:24 +0200, Clinton Gormley wrote:
> The framework does quite a lot of work setting up the applications that
> depend on it, and one of the things it does is autoconfigures the
> virtual hosts that the application requires.

When I need to do things like that, I just template httpd.conf and make
my apachectl script rebuild it whenever I start apache.  It has the
advantage that it works even on non-mod_perl servers like my front-end
proxy.

- Perrin


Re: Output from apache during startup

Posted by Clinton Gormley <cl...@traveljury.com>.
> Thats possibly because STDERR isn't tied to anything yet.  There's  
> some black magic that seems to go on.

That's correct
http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlConfigRequire_

I knew that was the case, it just interferes with the behaviour that I
would like.

I think I've figured on the following:
 - the startup info isn't really important except when you're debugging
 - so normally have setup happen during the restart_count!=1 phase
 - include a -Dverbose flag when you WANT to see what is going on, which
would set it to load the setup when restart_count==1



Re: Output from apache during startup

Posted by Jonathan Vanasco <jo...@2xlp.com>.
> WHEN restart_count!=1
>  - setup happens only when it should, but you don't see any of the
>    startup info.
>  - if I print the startup info to STDERR instead of STDOUT, then you
>    don't see anything on 'apachectl start', but you do on
>    'apachectl restart'

Thats possibly because STDERR isn't tied to anything yet.  There's  
some black magic that seems to go on.

FWIW:
	restart=1 - apache  turned on
	restart=2 - apache killed itself + reloads config files
	restart >2 - restart, etc