Skip to content

Instantly share code, notes, and snippets.

@alexander-arce
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save alexander-arce/a0f9a3503fe85655ac8f to your computer and use it in GitHub Desktop.

Select an option

Save alexander-arce/a0f9a3503fe85655ac8f to your computer and use it in GitHub Desktop.
AutoSSH tunnel mysql
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
# autossh startup Script
description "autossh daemon startup"
start on net-device-up IFACE=eth0
stop on runlevel [016]
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 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -p 2022 -L 3307:localhost:3306 xxx@xxxx.m.com
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment