For background information, it might be worth reading (on Linux)
man 7 signal.
When you hit CTRL-C then a SIGINT is sent to all the processes in the foreground group. When you use the
shell built-in command
kill the shell will send SIGTERM. If you are getting different behavior with different signals then someone must be trapping the SIGTERM. Ignore signals are usually inherited.
In addition, usually, when a parent dies it sends a SIGHUP to the child, which might kill the child, again depending on signal handling, for example using the
nohup program or trapping SIGHUP will prevent this.
Keeping track of PIDs should not be difficult, it is the return value of
fork in the parent. Provided the children of B are not ignoring hangups, then killing B should bring the children down as well.
Alternatively, from
kill:
"
Unlike in the shell, if SIGNAL is negative, it kills process groups instead of processes."
Provided the children have not switched process groups (which a daemon might do) then that might be a safer bet. It is not worth calling a shell's version of
kill using
system when there is one built-in to perl.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.