Ditutup

Perl module Net::RSH problems on timeout controlling

Hi there senior and experimented SEO..

I have in trouble with a big shit, on Perl, using the module rsh to connect to a list of remote sites, i have running this code:

[...]

#!/usr/bin/perl

use Net::Ping;

use Net::Ifconfig::Wrapper;

use Net::Rsh;

... ...

PropagateStatus(@NodeList,$ProxyNo);

sub PropagateStatus {

local *listnodes=@_[0];

# Set remote status files to itself as the MasterProgram

local $command = "echo " .$_[1] ." > " .$status_file;

local $rsh_connection=Net::Rsh->new();

foreach (@listnodes) {

chomp($_);

print "RSH access to " ."-$username\@$_- \n";

print "Executing: $command at remote host\n";

@tmp=$rsh_connection->rsh($_,$username,$username,$command);

}

}

ok, this code, makes a rsh connection to a list of available nodes (from a file)

but suddenlly, if one node have crashed the service it still get connected,

and doesnt release from this node to connect to the next... because the module Net::Rsh doesnt have a time out to to that, so i think i have found the solution:

....

local $rsh_connection=Net::Rsh->new();

foreach (@listnodes) {

$SIG{ALRM} = \&temporizador;

$time=15;

eval {

alarm($time);

chomp($_);

print "RSH access to " ."-$username\@$_- \n";

print "Executing: $command at remote host\n";

@tmp=$rsh_connection->rsh($_,$username,$username,$command);

}

}

alarm(0);

};

if ($@ =~ /End of timer/){

print "Returns timer code\n";

}else{

print "Returns no code: $res\n";

}

sub temporizador {

# how its added

die "Timeup of timer";

}

Could someone with high level of Perl please help me add this timer function on this code? Its very usefull for scripts that makes high availability of checking process running on others machines...

Kemahiran: Perl

Lihat lebih lanjut: rsh timeout, perl rsh, perl net rsh, perl rsh timeout, perl rsh module, perl library rsh, rsh time, perl rsh timeout alarm, perl rsh command, rsh module perl, solution problems, perl get, level status, perl temporizador, perl netrsh, rsh timeout solaris, perl remote command rsh, rsh timeout perl, executing code rsh node, netrsh timeout, alarm rsh perl, catch timeout rsh perl, rsh perl, binperl system rsh, set timeout rsh commands

Tentang Majikan:
( 0 ulasan ) Madrid, Spain

ID Projek: #356600