questo script una volta lanciato entra automaticamente nella shell redboot senza fare le corse a lanciaretelnet dopo che sono impazzito con una fonera oppure con un NAS linksys..è stato la mia salvezza:

#!/usr/bin/perl -w
# telnet_redboot.pl – ./upslug –reset;arping -f 192.168.0.1;telnet 192.168.0.1 9000

use Net::Telnet ();

my $host = ‘192.168.1.254’;

# system(“/usr/local/bin/upslug -r”);
printf(“NSLU2 reset\n”);
system(“/usr/bin/arping -f $host”);
printf(“NSLU2 arping response\n”);

my $t = new Net::Telnet (Port => 9000, Timeout => 30);
if(!defined($t)){
print “new Net::Telnet failed\n”;
exit(1);
} # if
my $ok;
$ok = $t->errmode(“return”);
$ok = $t->open($host);
if(!defined($ok)){
print “open(‘$host’) failed\n”;
$t->close();
exit(1);
} # if

# == Executing boot script in 1.930 seconds – enter ^C to abort

my $line;
while($line = $t->getline()){
$line =~ s/[\r\n]//;
print “-> $line\n”;
if($line =~ m/enter \^C to abort/){
$t->put(chr(3)); # send ^C
print “<- \^C\n”;
$t->close();
sleep(1);
system(“telnet $host 9000”);
exit(0);
} # if
} # while
$t->close();

Advertisements