You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by shahid <s....@gmail.com> on 2006/12/01 08:32:14 UTC

Invocation of any Handler before Apache's shutdown

Hi,

I am a newbie.

I am writing a new module for starting/shuttingdown a process(which is
dependent on Apache)  when Apache is starting/shutting down in WINDOWS.

I am able to do startup/shutdown by using ap_hook_child_init ,
apr_pool_cleanup_register.


apr_pool_cleanup_register is getting called after  httpd is down. But my
requirement is it needs to be called before the shutdown of Apache.

Is there any handler to do it? If not , is there any other way?

I need to know the Apache installed PATH , is there any environmental
variable set which contains the apache path?

Your help will be really appreciated. Looking for early responses.

Regards,
Shahid

Re: Invocation of any Handler before Apache's shutdown

Posted by shahid <s....@gmail.com>.
Thanks nick.

>I think you're looking to wrap apache from outside, rather than write
>a module.

Yes, I need a wrapper mechanism for notifying the startup and shutdown of
Apache. I could do that in UNIX by modifying the apachectl. As there is no
such script in WINDOWS I opted for a module.

Please let me know if you have any inputs regarding the wrapper mechanism(
instead of a module )

Regards,
Shahid




On 12/1/06, Nick Kew <ni...@webthing.com> wrote:
>
> On Fri, 1 Dec 2006 13:02:14 +0530
> shahid <s....@gmail.com> wrote:
>
> > Hi,
> >
> > I am a newbie.
> >
> > I am writing a new module for starting/shuttingdown a process(which is
> > dependent on Apache)  when Apache is starting/shutting down in
> > WINDOWS.
>
> In general, modules are not platform-specific (except MPMs).
>
> Corollary: if yours is, that could indicate that it shouldn't really
> be a module.
>
> (there are exceptions to this rule: treat "Module for [platform]"
> as a Warning but not an Error).
>
> > I am able to do startup/shutdown by using ap_hook_child_init ,
> > apr_pool_cleanup_register.
>
> child_init happens after apache has forked child processes.
>
> Corollary: it's really for internal initialisation.  If you use
> it for external things like starting a process, you have to worry
> about how many instances of your process get started.
>
> A pre_config or post_config hook would avoid this issue.
>
> > apr_pool_cleanup_register is getting called after  httpd is down. But
>
> No, your cleanup is part of the shutdown process.  Neither before
> nor after shutdown.
>
> > my requirement is it needs to be called before the shutdown of Apache.
>
> I think you're looking to wrap apache from outside, rather than write
> a module.  But if you really want a module, take a look at Jeff
> Trawick's introspection modules as a startingpoint
> (see http://people.apache.org/~trawick/).
>
> > Is there any handler to do it? If not , is there any other way?
> >
> > I need to know the Apache installed PATH , is there any environmental
> > variable set which contains the apache path?
>
> Sounds like SERVER_ROOT.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.org/
>

Re: Invocation of any Handler before Apache's shutdown

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 1 Dec 2006 13:02:14 +0530
shahid <s....@gmail.com> wrote:

> Hi,
> 
> I am a newbie.
> 
> I am writing a new module for starting/shuttingdown a process(which is
> dependent on Apache)  when Apache is starting/shutting down in
> WINDOWS.

In general, modules are not platform-specific (except MPMs).

Corollary: if yours is, that could indicate that it shouldn't really
be a module.

(there are exceptions to this rule: treat "Module for [platform]"
as a Warning but not an Error).

> I am able to do startup/shutdown by using ap_hook_child_init ,
> apr_pool_cleanup_register.

child_init happens after apache has forked child processes.

Corollary: it's really for internal initialisation.  If you use
it for external things like starting a process, you have to worry
about how many instances of your process get started.

A pre_config or post_config hook would avoid this issue.

> apr_pool_cleanup_register is getting called after  httpd is down. But

No, your cleanup is part of the shutdown process.  Neither before
nor after shutdown.

> my requirement is it needs to be called before the shutdown of Apache.

I think you're looking to wrap apache from outside, rather than write
a module.  But if you really want a module, take a look at Jeff
Trawick's introspection modules as a startingpoint
(see http://people.apache.org/~trawick/).

> Is there any handler to do it? If not , is there any other way?
> 
> I need to know the Apache installed PATH , is there any environmental
> variable set which contains the apache path?

Sounds like SERVER_ROOT.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/