command.pl example
#!/usr/bin/perl
use Net::Telnet;
my @stdinput = <STDIN>;
my $input;
my $output;
my $out;
my $host;
my $user;
my $pass;
my $local = 1;
my $cmd;
:
:
:
my $telnet = Net::Telnet->new(Host=>$host,Cmd_remove_mode=>1,Timeout=>180);
$telnet->login($user,$pass);
if ($ENV{'HORCMROOT'} ne "")
{
$cmd = "echo \"" . $input . "\" | " . $ENV{'HORCMROOT'} . "\\HORCM\\etc\\rmsra -auto timeout=" .
$ENV{RMSRATOV} . " testMU=" . $ENV{'RMSRATMU'} . " -XMLSTDOUT";
}
else
{
$cmd = "rm -f " . $txtname;
$telnet->cmd($cmd);
foreach my $line (@input)
{
$cmd = "echo \'" . $line . "\' >> " . $txtname;
$telnet->cmd($cmd);
}
$cmd = "cat " . $txtname . " | /HORCM/usr/bin/rmsra -auto timeout=" . $ENV{'RMSRATOV'} . "
testMU=" . $ENV{'RMSRATMU'} . " -XMLSTDOUT >" . $xmlname . " 2>" . $logname;
}
$telnet->cmd($cmd);
$cmd = "cat " . $logname . " >> " . $xmlname;
$telnet->cmd($cmd);
$cmd = "cat " . $xmlname;
my (@stdout, @stderr, $exit) = $telnet->cmd($cmd);
foreach my $line (@stdout)
{
if ($line =~ /^\s*<|wwn=/)
{
$output = $output . $line;
}
elsif ($line =~ /^\[RMSRA\]/)
{
print $line;
}
}
$out = "> " . $out;
open(OUT,$out);
print OUT $output;
close(OUT);
exit($exit/256);
Overview of HP StorageWorks XP Virtualization Adapter
10