Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: kill command in perl?

by hbo (Monk)
on Jul 30, 2004 at 07:20 UTC ( #378612=note: print w/replies, xml ) Need Help??

in reply to kill command in perl?

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

Replies are listed 'Best First'.
Re^2: kill command in perl?
by Joost (Canon) on Jul 30, 2004 at 08:53 UTC
Re^2: kill command in perl?
by exussum0 (Vicar) on Jul 30, 2004 at 10:39 UTC
    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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://378612]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-05-25 21:09 GMT
Find Nodes?
    Voting Booth?