Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Net::OpenSSH Problem

by salva (Abbot)
on Sep 12, 2013 at 08:15 UTC ( #1053672=note: print w/replies, xml ) Need Help??


in reply to Re^2: Net::OpenSSH Problem
in thread Net::OpenSSH Problem

what happens when you run the following code?
my $ssh = Net::OpenSSH->new($host, user => $USERNAME, password => $PASSWORD, strict_mode => 0); $ssh->error and die "Couldn't establish SSH connection: " . $ssh->erro +r; $ssh->system('!pwd') or die "remote command failed: " . $ssh->error; print "pwd done\n";

Replies are listed 'Best First'.
Re^4: Net::OpenSSH Problem
by kburns1969 (Novice) on Sep 12, 2013 at 16:59 UTC
    It runs fine outputting my current home dir. Def a problem of it not giving back control to the script or something ??
    $ssh->error and die "Couldn't establish SSH connection: " . $ssh->erro +r; $ssh->system('!bash') or die "remote command failed: " . $ssh->error; # remote end will look like this after !bash # bp>!bash # [kburns@ssl01-d:Active] ~ # print "will never print this line\n"; $ssh->system('pwd') or die "remote command failed: " . $ssh->error;
      It runs fine outputting my current home dir

      Then, you don't need to execute !bash at all.

      Just run via Net::OpenSSH system (or capture?) the commands you want to run on the remote machine prefixing them by an exclamation mark.

        Arghhhhh. I was about to respond with why this was still a problem and then realized I can execute the vendors shell and it's commands from the legacy BSHELL. These boxes (F5 LBs) have an older CLI Shell and a Newer one. To get into the newer one you would typically just run !bash and then the 'tmsh' command. From there you could run the show commands (show ltm virtual, etc). I never realized I could execute them right from the BSHELL like B>!tmsh sho ltm virtual detail Now I just need to figure out the capture part. Thanks a bunch. Hopefully you will be rid of me for now :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053672]
help
Chatterbox?
[GotToBTru]: what is clear and what is not can be personal
[LanX]: actually you can skip the arrows in between and it will still work
[choroba]: -> between curlies and square brackets is optional
[GotToBTru]: you probably have the problem firmly fixed in your mind. question is .. when you come back to this in 6 months time, will it still be as clear
[ambrus]: if you have such a deep data structure, and you have trouble dereferencing it, then you should probably think through whether that's really the best data structure you should use
[choroba]: $aohoaoh[0]{foo}[0 ]{bar} was my suggestion

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2016-12-06 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (105 votes). Check out past polls.