>From PERL, I have been doing some system calls like this:
(see * lines)
* my $procentry=`ps -ef | grep -v grep | grep $self->{pid} `;
chomp $procentry;
$self->debug(1, "Procentry: [$procentry]");
if ($procentry =~ /\<defunct\>/ ) {
$self->debug(1, " <--- closed ssh tunnel. Tunnel proc defunct");
$tunnelok=0;
}
* my $nstat=`netstat -an | grep '127.0.0.1' `;
chomp $nstat;
$self->debug(1, "NStat: [$nstat]");
if (!$nstat) {
$self->debug(1, " <--- closed ssh tunnel. Netstat result empty");
$tunnelok=0;
}
Is this really computationally expensive?
(I already know this makes my code not portable)
Im not calling these very often, is there a better way to do this?
thanks,
Matt