Update
Well, the following snippet of code is pretty ugly, but it seems
to work. It is executed by the server program in response to
a command from the client via SOAP.
my @ps = `ps -ef`;
my @pid = (split(/ +/, (grep(/login -- mrc/, @ps))[0]))[1];
my @kill;
while (1) {
last unless @pid = grep {$_ > 1} @pid;
push @kill, @pid;
my $pidlist = join('|', @pid);
last unless @pid = grep(/\s+[\d]+\s+($pidlist) /, @ps);
@pid = map {(split(/\s+/, $_))[1]} @pid;
}
kill 'TERM', @kill
What this does is get a list of all running processes, finds
one named "login -- mrc", then goes through the list
looking for all its children, children's children, etc.
Once it's done this, it kills them all. Ugh.
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.