Systemd service for autossh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|Description=Keeps a tunnel to 'remote.example.com' open|
|# -p [PORT]|
|# -l [user]|
|# -M 0 --> no monitoring|
|# -N Just open the connection and do nothing (not interactive)|
|ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -p 22 -l autossh remote.example.com -L 7474:127.0.0.1:7474 -i /home/autossh/.ssh/id_rsa|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
I think it would be better idea to add
.servicefile because that will kill everything that was started (recursively) and nothing more. In addition, it will first send
SIGKILLonly if the process will not stop nicely.
If you randomly kill one or all
autosshprocesses in the system, you might kill more than expected if
autosshis used for other stuff, too.
See https://www.freedesktop.org/software/systemd/man/systemd.kill.html#KillMode= for details