Skip to content

Instantly share code, notes, and snippets.

@abonec
Created March 10, 2014 13:09
Show Gist options
  • Save abonec/9464682 to your computer and use it in GitHub Desktop.
Save abonec/9464682 to your computer and use it in GitHub Desktop.
Port forwarding for upstart via autossh and ssh
description "autossh daemon"
start on net-device-up IFACE=eth0
stop on runlevel [01S6]
respawn
respawn limit 5 60 # respawn max 5 times in 60 seconds
script
export AUTOSSH_PIDFILE=/var/run/autossh.pid
export AUTOSSH_POLL=60
export AUTOSSH_FIRST_POLL=30
export AUTOSSH_GATETIME=0
export AUTOSSH_DEBUG=1
autossh -M 0 -4 -N do -i /home/pi/.ssh/id_rsa -R 6001:localhost:9091 -R 6002:localhost:22 -R 6003:localhost:8030 -o "ServerAliveInterval 3" -o BatchMode=yes -o StrictHostKeyChecking=no
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment