#!/usr/bin/env perl -w -s use Net::Telnet (); my $username = 'root'; my $password = 'passw0rd'; my $local = '10.10.4.46'; print "46 leads to => 10.10.4.46"; my $machine =<>; chomp $machine; while ($machine ne '46'){ print "\nBad entry :\n"; $machine = <>; chomp $machine; } if ($machine eq '46') { my $t = new Net::Telnet (Timeout => 10); $t->open("$local"); $t->login($username, $password); print "\n\n\n\n\t\t\tConnexion to 10.10.4.46... \n\n\n"; print "Enter to continue\n\n"; my $pass = <>; chomp $pass; while ($pass ne '99') print "004 = destroy volume\n"; my $pass = <>; chomp $pass; if($pass eq '004'){ print "\n\n\n Menu to destroy aggr or a volume\n"; my $value = <>; chomp $value; while($value ne '99'){ print "\n\n Destroy aggr = 1 \t Destroy volume += 2\n\n"; my $choice = <>; chomp $choice; if($choice eq '1'){ @lines =$t ->cmd ("sysconfig -r" +); print @lines; print "\n\nEnter the name of agg +r to destroy"; my $aggr = <>; chomp $aggr; @lines = $t ->print ("aggr destr +oy $aggr"); $t ->waitfor('/Are you sure you +want to destroy this aggregate ?/'); @lines = $t ->cmd ('yes'); print @lines; }
Here's the issue with an aggregate, it actually works, it destroys the aggregate ( checked in with my server ) but I got a timeout ( command timed-out at project.pl line 916 ) at the end of this and my "print @lines;" isn't functionning, don't have any response when I type my aggregate name
elsif($choice eq'2'){ @lines =$t ->cmd ("sysconfig -r" +); print @lines; print "\n\nEnter name of the vol +ume to destroy : "; my $vol = <>; chomp $vol; @lines =$t ->print ("vol destroy + $vol"); $t ->waitfor('/Are you sure you +want to destroy this volume ?/'); $t ->cmd ('yes'); print @lines; }
The exact same thing in here, it destroys my volume but also got a timeout and no response/display....
I hope i've been clear enough for you to understand my situation. Thanks !print "\n\n\n Entrer pour conti +nuer... (99 pour quitter)\n"; my $exit = <>; chomp $exit; if($exit == "99"){ last; } } }
In reply to Troubles with Telnet module by Pohkaymon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |