Created
September 6, 2012 07:05
-
-
Save wolfg1969/3652371 to your computer and use it in GitHub Desktop.
autossh upstart conf
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
# tunnel - secure tunnel to my vps | |
description "ssh tunnel" | |
start on (local-filesystems and network-device-up IFACE!=lo) | |
stop on runlevel [!12345] | |
respawn | |
respawn limit 5 60 # respawn max 5 times in 60 seconds | |
umask 022 | |
script | |
echo "DEBUG: `set`" >> /tmp/tunnel.log | |
export AUTOSSH_PIDFILE=/var/run/tunnel.pid | |
export AUTOSSH_PORT=10007:7 | |
export AUTOSSH_POLL=60 | |
export AUTOSSH_FIRST_POLL=30 | |
exec sudo -H -u user -s autossh -4 -N -D 3128 -o BatchMode=yes -o StrictHostKeyChecking=no -i /home/user/.ssh/tunnel_id_rsa user@host | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing your upstart script!
Three comments:
start on
stanza didn't work for me on ubuntu 13.10. Usingstart on net-device-up
did the trick for me.-E
option to sudo to preserve the environment variables you just exported.AUTOSSH_GATETIME
environment variable and set it to0
to make autossh ignore the first run failure of ssh (in case the remote host is down when autossh starts).Bests,
Bram