If I understand what you're asking, it's as simple as:
$SIG{INT} = $SIG{TERM} = sub {
kill 15 => @process_i_want_to_term;
exit;
};
or perhaps even
END {
kill 15 => @process_i_want_to_term;
}
------------
:Wq
Not an editor command: Wq
| [reply] [d/l] [select] |
| [reply] |
But if those processes are running on "other servers," you will have to issue a remote kill, with the shell, in that signal handler:
$SIG{INT} = $SIG{TERM} = sub {
`ssh remote_server killall -9 everything`;
exit;
};
You might want to be more selective than in the example. 8)
"Even if you are on the right track, you'll get run over if you just sit there." - Will Rogers
| [reply] [d/l] |
And don't use killall for this on solaris!
| [reply] |
The easiest way to be more selective, is to generate a random number, md5 it and pass it along as a dummy parameter. I've done that by wrapping the target server program in a perl script, and simply ignoring it. When I have to kill the thing off, i check the process list for that random number so that I kill less things off. I also have the perl script on the remote server kill itself off in reasonable time in case someone yanks a net cable.
Bart: God, Schmod. I want my monkey-man.
| [reply] |