Hi,
stripped it down to that level:
#!perl -w
use strict;
use warnings;
use Data::Dumper;
use Net::OpenSSH;
my $sshuser="user";
my $sshpwd="pwd";
my $device = $ARGV[0];
my $sshcmd = $ARGV[1];
my $error;
my $ssh;
my $path = "./Y.ssh";
$ssh = Net::OpenSSH->new(
$device,
user => $sshuser,
passwd => $sshpwd,
ctl_dir => $path,
master_opts => [-o => "StrictHostKeyChecking=no", -o => "UserKnown
+HostsFile=/dev/null"],
strict_mode => 0,
master_stderr_discard => 1 # to get rid of login screen
);
my @cmdout;
my @cmdout2;
@cmdout2 = $ssh->capture({stdin_data => "\n"}, $sshcmd."\n");
open FILE, "<", "./rawout.txt";
@cmdout = <FILE>;
close(FILE);
$ssh->master_exited;
foreach (@cmdout) {
print $_;
}
exit 0;
YES - program is for testing ONLY
no sense !!
BUT
output misses some lines from time to time!!
Output is FINE if I don't run the capture
back to you - I'm out of ideas now, at least for today
Thanks for help!!
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.