- [Unit]
- Description=Keeps a tunnel to 'remote.example.com' open
- After=network.target
- [Timer]
- #This portion doesnt work
- OnBootSec=4min
- [Service]
- User=root
- Type=forking
- # -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="LOCAL_ADDR=localhost"
- #EnvironmentFile=/etc/default/secure-tunnel@%i
- Environment="AUTOSSH_GATETIME=0"
- ExecStart=/usr/bin/ssh -NTC -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -D3130 -p 6000 USER@HOSTNAME -i /root/.ssh/id_rsa 2>&1
- #ExecStart=/usr/bin/autossh -M 0 -N -T -q -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -D3130 -p 6000 USER@HOSTNAME -i /root/.ssh/id_rsa
- ExecStop=/usr/bin/kill $(lsof -t -i:3130)
- #RestartSec=400
- #Restart=always
- [Install]
- WantedBy=multi-user.target