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 Andy Grant <an...@gmail.com> on 2008/04/08 20:44:35 UTC

Functions run when configuration file is read

I am writing a module that runs certain functions depending on the 
configuration directives in the conf files.  The functions are run twice 
when the server is started and again when the server shuts down.  Is 
there a way to make the functions run only once?  Maybe some variable 
that can be checked stating that the server is reading the conf files, 
actually starting the server, or shutting down?

Thanks

Re: Functions run when configuration file is read

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
On Apr 8, 2008, at 8:44 PM, Andy Grant wrote:

> I am writing a module that runs certain functions depending on the  
> configuration directives in the conf files.  The functions are run  
> twice when the server is started and again when the server shuts  
> down.  Is there a way to make the functions run only once?  Maybe  
> some variable that can be checked stating that the server is reading  
> the conf files, actually starting the server, or shutting down?


Do a grep through the modulues for comments like 'first run'. It is  
common for modules to do something post their conf init like:

.._init()
	if (...) {
		first run -- ignore
		set some flag
	} else {
		do...

for example to first gather all the configured hostnames and only then  
check if they can be reached.

Dw