in reply to Explicitly kill a Net::OpenSSH connection?
I would say you could either issue# various ways of starting a connection returning a $pid my ($in, $out ,$pid) = $ssh->open2("foo"); my ($pty, $pid) = $ssh->open2pty("foo"); my ($in, $out, $err, $pid) = $ssh->open3("foo"); my ($pty, $err, $pid) = $ssh->open3pty("login");
#or in case some shells are hiding in there ( which may cause defunct process)kill 9, $pid;
use Proc::Killfam; killfam 9, $pid
See Stopping subprocesses for a discussion of this. As a last resort, you can always search the process table for your process name, get the pid and kill it. Changing $0 of your script would make it easier to find in the process table, like
$0 = 'rastoboy-ssh'; # :-)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Explicitly kill a Net::OpenSSH connection?
by rastoboy (Monk) on Aug 03, 2011 at 13:59 UTC |