Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 85675 invoked from network); 2 Aug 2007 16:48:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Aug 2007 16:48:13 -0000 Received: (qmail 66416 invoked by uid 500); 2 Aug 2007 16:48:13 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 66174 invoked by uid 500); 2 Aug 2007 16:48:12 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 66146 invoked by uid 99); 2 Aug 2007 16:48:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2007 09:48:12 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [165.254.4.17] (HELO mcf.com) (165.254.4.17) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2007 16:47:45 +0000 Received: from [165.254.4.10] (165.254.4.10) by mcf.com with ESMTP (EIMS X 3.3.2) for ; Thu, 2 Aug 2007 12:48:29 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20070731230154.6dc5b629@grimnir> Date: Thu, 2 Aug 2007 12:47:38 -0400 To: modules-dev@httpd.apache.org From: Farokh Irani Subject: Re: Module initialization Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Virus-Checked: Checked by ClamAV on apache.org >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/.