Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: How do you use Net::OpenSSH to query mysql database via ssh tunnel

by nysus (Parson)
on May 09, 2017 at 15:12 UTC ( [id://1189916]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do you use Net::OpenSSH to query mysql database via ssh tunnel
in thread How do you use Net::OpenSSH to query mysql database via ssh tunnel

So following the advice on the link above and another page it references, I got this:

my $pid = $ssh->spawn({ssh_opts=> '-fL 127.0.0.1:12345:127.0.0.1:3306' +}, 'sleep 10');

The big advantage is no more sleep command (except on the remote machine but that doesn't delay anything). Nice.

And, apparently, as long as you do a query within 10 seconds it will work and it will autoclose the tunnel after that.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Re^3: How do you use Net::OpenSSH to query mysql database via ssh tunnel
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1189916]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-24 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found