python and paramiko: how to check if end of ssh tunnel is still alive and reestablish if not?

Posted by Christian on Stack Overflow See other posts from Stack Overflow or by Christian
Published on 2010-05-08T15:03:10Z Indexed on 2010/05/08 15:08 UTC
Read the original article Hit count: 309

Filed under:
|
|
|
|

Hello all,

I'm trying to achieve the following:

I have two hosts A and B. A establishes a remote port forwarding tunnel on B, i.e. B is the one a port is forwarded on to some where else and A is the one that sets up the tunnel. I tried the script rforward.py that ships with paramiko and it works very well so far. (I'm running rforward.py on A, which connects to B and forwards a port of B to somewhere else)

However, when B is shutting down, A doesn't seem to recognize it. I'd rather like A to recognize that B is down and to try to reestablish the connection periodically in case B comes up again.

Is there a way to do this? Thanks.

© Stack Overflow or respective owner

Related posts about ssh-tunnel

Related posts about ssh