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"; }
In reply to Net::OpenSSH Problem by kburns1969
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |