Skip to content

Instantly share code, notes, and snippets.

@sahilsk
Last active March 9, 2017 07:42
Show Gist options
  • Save sahilsk/334dec955bdbebc4a42b to your computer and use it in GitHub Desktop.
Save sahilsk/334dec955bdbebc4a42b to your computer and use it in GitHub Desktop.
ssh tunneling upstart script. Tags: upstart, ssh, tunnel, init
# vim: syntax=upstart
expect fork
umask 0000
start on runlevel [2345]
stop on runlevel [!2345]
script
exec ssh -o StrictHostKeyChecking=no -nf -Ng -L 3307:host-connect-to-RDS-may-be.com:3306 [email protected] -i /home/ubuntu/.ssh/my-precious.pem
end script

Instructions

  • Create upstart file

    vim /etc/init/create_tunnel.conf

  • Start the script

    sudo service create_tunnel start|stop|restart|status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment