Hmmm....Two thoughts about that.

First: Assuming that script B on its own won't end without its child processes to end first, I think that calling pkill from script A will kill script B's child processes. Then if script A kills script B directly, then you won't hit that issue. Of course, I may be assuming more than I should or assuming incorrectly.

Second: If script B is coded such that it can call die without killing its child processes, I would think that there should be a way to modify the code to call pkill first to kill its child processes before actually exiting out. Of course, if something else is killing from the OS, then you might have the orphaned processes as you described.

I'm not disagreeing with you. Just thinking out loud in case any of this might be helpful for you or others to figure out a solution. That and hoping that I don't sound like a blabbering idiot. :D


In reply to Re^3: Stopping subprocesses by dasgar
in thread Stopping subprocesses by James Board

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.