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
|
|---|