When starting an SSH tunnel 'piped output' hangs

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi All,

When starting an SSH tunnel, 'piped output' hangs (on AIX) :

ssh -Nf -Llocalhost:22000:server:22 proxy | cat -
... hangs ...

Of course, I don't use the tunnel as I do in the example above. In my
script the call to ssh is part of a function that does some checks.
It's the output of those checks that I want to pipe to a logging
function, something like :

function start_tcp_tunnel
  pre checks...
  ssh -Nf -Llocalhost:22000:server:22 proxy
  post checks...

function log {
  while read line ; do
    echo $(date) $line

start_tcp_tunnel | log

I Googled and read about the '-n' option and redirecting stdin from /
dev/null but that doesn't work in this case...

Any help is much appreciated.


Site Timeline