#!/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 aggr to destroy";
my $aggr = <>;
chomp $aggr;
@lines = $t ->print ("aggr destroy $aggr");
$t ->waitfor('/Are you sure you want to destroy this aggregate ?/');
@lines = $t ->cmd ('yes');
print @lines;
}
####
elsif($choice eq'2'){
@lines =$t ->cmd ("sysconfig -r");
print @lines;
print "\n\nEnter name of the volume 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;
}
####
print "\n\n\n Entrer pour continuer... (99 pour quitter)\n";
my $exit = <>;
chomp $exit;
if($exit == "99"){
last;
}
}
}