AutoSSH for a robust tunnel
- by Budric
I'm trying to start an ssh tunnel from A to B and have it run despite things like: period network/wifi drops on A and remote server reboot on B. My ssh tunnel starts using upstart script on A with event start on (net-device-up IFACE=eth0)
I've found autossh which is supposed to handle these kinds of things, but had some trouble getting it to work. The upstart executes:
autossh -M 0 -2qTN -o "ServerAliveInterval 30" -o "ServerAliveCountMax 2" -L 5678:somehost:5678 user@B
However when I log into B and kill -9 that tunnel session, autossh just exits with "Connection to B closed by remote host." That's not what I expected autossh to do.
Any advice on how to set this up? Any GUI service monitoring utilities out there that essentially display a green light if a service is up?
Thanks.