Este es el código, a ver si alguien pudiese echarle un vistazo, gracias:
Script original (cortado, solo dejo lo interesante, el control del flujo)
Using perl Syntax Highlighting
#!/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);
}
}
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);
}
}
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
Hace una conexión rsh al primer nodo disponible pero si falla no es capaz de seguir con el siguiente nodo del array nodelist.
Aquí he encontrado una posible solución, ¿podríais echarle un ojo para revisar si está correcto? ¿o si disponéis de alguna otra posible solución?
Using perl Syntax Highlighting
local $rsh_connection=Net::Rsh->new();
foreach (@listnodes) {
$SIG{ALRM} = \&temporizador;
$time=10;
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";
}
foreach (@listnodes) {
$SIG{ALRM} = \&temporizador;
$time=10;
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";
}
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
Gracias, un saludo.