August 27, 2008
Posted by on
Autossh is a nice way to keep a ssh connection alive. This is especially useful when it comes to ssh tunnels. To make things even more automagicial I have now written the init script template autossh_tunnel.foo.
A few import facts regarding the script:
- Autossh 1.4 or later is required. Earlier versions of autossh doesn’t handle PID-files.
- The init script is based on the start-stop-daemon. Hence it will probably only work on Debian, Ubuntu and similar systems.
- There is no way to enter a password. A setup based on ssh-keys or similar is required.
- Autossh doesn’t handle every kind of ssh problem. Because of that it is possible for the initial connection to fail without the init script knowing about it.
This is by the way my first real init script. Any feedback on it would be greatly appreciated.