On 9/10/07, Ashwani Kumar Sharma <[EMAIL PROTECTED]> wrote:

> In my application I am spawning httpd.exe from the parent process.
...
> My requirement is that:
...
> In the Abnormal termination of the parent process. The Apache should keep
> looking for its parent process. If the parent process is not present
>
>        then the Apache web server should also kill itself.
> How can I implement the 2nd point?

not even a half-baked idea:

Somebody gets the monitor hook called from the Windows MPM (i.e.,
fixes Apache on Windows to call a hook that is provided on
Unix/Linux).

   General idea (mpm_winnt.c)

    /* Wait for shutdown or restart events or for child death */
    winnt_mpm_state = AP_MPMQ_RUNNING;
    do {
        rv = WaitForMultipleObjects(NUM_WAIT_HANDLES, (HANDLE *)
event_handles, FALSE, something-that-means-one-second);
       if (rv == WAIT_TIMEOUT) {
            ap_run_monitor(pconf);
       }
    } while (rv == WAIT_TIMEOUT);

(remove existing check for WAIT_TIMEOUT that considers it a fatal error)

Your application starts httpd.exe with a define like

   -DMOD_FOO_MONITORED_PID=13579

and a config that loads a custom plug-in module provided by you which
implements the monitor hook that checks for when that pid goes away.

???How to make the monitor hook take down httpd?  apache -k stop???

Reply via email to