kburns1969 has asked for the wisdom of the Perl Monks concerning the following question:
I need to automate some commands on a load balancer that allow me to get a couple levels deep to the right vendor shell. This involves telling the appliance to go into bash and then to run another tmos shell. Manually it looks like this:
The module seems to hang after attempting to run the !bash command. Here is the code.-bash-4.1$ ssh 10.10.10.1 Password: Last login: Tue Sep 10 22:01:12 2013 from 10.10.10.1 bp>!bash [kburns@ssl01:Active] ~ #
#!/usr/bin/perl use Net::OpenSSH; my $host = "10.10.10.1"; my $USERNAME = "kburns"; my $PASSWORD = "xxxx"; my $ssh = Net::OpenSSH->new($host, user => $USERNAME, password => $PAS +SWORD, strict_mode => 0); $ssh->error and die "Couldn't establish SSH connection: " . $ssh->erro +r; $ssh->system({quote_args => 0}, "!bash") or die "remote command failed +: " . $ssh->error; print "finished bash\n"; #never gets here. it hangs $ssh->system({stdin_data => \@output}, "ls") or die "remote command fa +iled: " . $ssh->error; foreach $line (@output) { print "$line\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::OpenSSH Problem
by kcott (Archbishop) on Sep 11, 2013 at 00:30 UTC | |
|
Re: Net::OpenSSH Problem
by salva (Canon) on Sep 11, 2013 at 08:09 UTC | |
by kburns1969 (Novice) on Sep 11, 2013 at 16:28 UTC | |
by salva (Canon) on Sep 12, 2013 at 08:15 UTC | |
by kburns1969 (Novice) on Sep 12, 2013 at 16:59 UTC | |
by salva (Canon) on Sep 12, 2013 at 17:18 UTC | |
|