Here i have written the perl script to run iperf server and client on two different linux box from remote system. Now problem i am getting is that, when i am launching iperf server command then control is not returning back to the remote machine, so that i am unable to run the iperf client.
Here is the script::
use Net::SSH::Expect;
use Proc::Background;
sub process {
}
sub OpenSshChnl {
$hst = shift;
$pass = shift;
$UN = shift;
my $ssh = Net::SSH::Expect->new (
host => $hst,
user => $UN,
password=> $pass,
raw_pty => 1,
);
my $login_output = $ssh->login();
if ($login_output !~ /Last login:/){
die "Login has failed. Login output was $login_output"
+;
}
else {
print "success \n"
}
print "Opned ssh channel to $hst\n";
}
@sys = (UE,'10.131.24.106',mguvvala,abc123,12345,eNb,'10.131.24.110',m
+guvvala,abc123,12345);
$ssh_UE1 = OpenSshChnl(@sys[1],@sys[3],@sys[2]);
$ssh_eNb1 = OpenSshChnl(@sys[6],@sys[8],@sys[7]);
$ssh_eNb1=>exec('iperf -s -u -i 1 -p 12345');
my $client = $ssh_UE1=>exec("iperf -c 10.131.24.110 -u -b 10M -i 1 -t
+3 -p 12345");
print "$client";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.