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!!
|