On Aug 1, 2007, at 1:48 PM, Farokh Irani wrote:

I must just be dense, but I've spent a whole bunch of time trying to figure exactly how I can put initialization code into my module. It's code that needs to run only once when apache (2.2.x) is starting up, so any pointers would be appreciated.

oops, incomplete answer:

static int your_routine(apr_pool_t * p_conf, apr_pool_t * p_log, apr_pool_t * p_temp);

/* register our interests */
static void hooks(apr_pool_t * p)
{
  ap_hook_pre_config(your_routine, NULL, NULL, APR_HOOK_MIDDLE);
 ...
}

module AP_MODULE_DECLARE_DATA atom_module = {
  STANDARD20_MODULE_STUFF,
  NULL,                       /* create per-directory config structure */
  NULL,                       /* merge per-directory config structures */
  NULL,                       /* create per-server config structure */
  NULL,                       /* merge per-server config structures */
  directives,                 /* handle config directive */
  hooks                       /* registrar */
};

OK, thanks for that tidbit. However, as someone else mentioned, if I need to do something when apache is restarted, will this do the trick?

Also, when apache is shutting down, can my module do clean up and how do I handle that?

Thanks!
--

Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS http://www.mcfsoftware.com/ar/.

Reply via email to