Created
November 29, 2018 15:03
-
-
Save edi33416/050af17852752122dc1994b2494cd525 to your computer and use it in GitHub Desktop.
systemd service script to create a reverse tunnel; Kudos Sergiu W (@sergiu121)
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
[Unit] | |
Description=Keeps a tunnel to 'fep.grid.pub.ro' open | |
After=network-online.target ssh.service | |
[Service] | |
User=<user-name> | |
# -p [PORT] | |
# -l [user] | |
# -M 0 --> no monitoring | |
# -N Just open the connection and do nothing (not interactive) | |
# LOCALPORT:IP_ON_EXAMPLE_COM:PORT_ON_EXAMPLE_COM | |
Environment=AUTOSSH_GATETIME=0 | |
ExecStart=/usr/bin/autossh -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -R <remote-port>:localhost:22 <user-name>@<remote-machine> | |
#ExecReload=/usr/bin/pkill --signal SIGKILL -f '/usr/lib/autossh.+fep.+' | |
#ExecStop=/usr/bin/pkill --signal SIGKILL -f '/usr/lib/autossh.+fep.+' | |
KillMode=process | |
Restart=on-failure | |
RestartSec=10 | |
Type=forking | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment