I see no really clean way to do this from mod_perl. The closest I can see would be to install a PerlChildExitHandler - as noted in Chapter 7 of the "eagle" book, "Writing Apache Modules with Perl and C" - but this runs each time a child apache process ends, so it would still have to check that it was the last child process left up, (because shutdown is not the only reason a process goes down), then kill your other daemon. And I'm not sure what a "child" process means, if anything, in the Win32 environment.

Update: If the child processes are put down in parallel during shutdown, (eg. they're all sent a signal as members of a process group) there could be a race, where your PerlChildExitHandler still sees other processes up when in fact they are all coming down. Your less-desired solution of having the other daemon check for the Apache process each time it loops may be the safest way to do this.

--Bob Niederman, http://bob-n.com

In reply to Re: starting/stopping a daemon from Apache/mod_perl? by bobn
in thread starting/stopping a daemon from Apache/mod_perl? by sri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.