in reply to Net::OpenSSH multiple commands
After a few more days of messing with this, I have gotten the following code to work.
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Net::OpenSSH; use Expect; my $host = '10.0.0.1'; my $ssh = Net::OpenSSH->new("$host", timeout => 30); $ssh->error and die "unable to connect to remote host: ". $ssh->error; my ($pty,$pid) = $ssh->open2pty or die "unable to run remote command show ip arp"; my $output = $ssh->capture({stdin_data => "term length 0\nterm width 512\nsh ver\nsh run\nexit\n"}); print $output;
This code, however, gives me 2 errors...
Pseudo-terminal will not be allocated because stdin is not a terminal. channel 4: open failed: resource shortage:
I have tried searching for a fix for them but I haven't found anything.
Would anyone know how I can fix these errors?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::OpenSSH multiple commands
by salva (Canon) on Apr 24, 2012 at 09:31 UTC | |
by mlebel (Hermit) on Apr 24, 2012 at 11:32 UTC | |
by mlebel (Hermit) on Apr 24, 2012 at 19:10 UTC | |
by salva (Canon) on Apr 25, 2012 at 09:22 UTC | |
by mlebel (Hermit) on Apr 25, 2012 at 11:36 UTC | |
by mlebel (Hermit) on May 24, 2012 at 15:25 UTC |