Skip to content

Instantly share code, notes, and snippets.

@huksley
Created January 28, 2015 10:44
Show Gist options
  • Save huksley/9c4495632f42fdacd3d2 to your computer and use it in GitHub Desktop.
Save huksley/9c4495632f42fdacd3d2 to your computer and use it in GitHub Desktop.
Sample script for autossh based tunnel (autorestart, keeping connection alive) https://www.async.fi/2013/07/autossh-with-ubuntu-upstart/
description "AutoSSH tunnel 1"
author "Huksley"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
expect fork
respawn
respawn limit 5 60
exec autossh -f -M 0 -N -L 8111:192.168.1.1:111 -i private.key -l username hostname -o "ServerAliveInterval=10" -o "ServerAliveCountMax=3" -o "StrictHostKeyChecking=no" -o "BatchMode=yes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment