Created
July 30, 2013 10:14
-
-
Save c9s/6111795 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# | |
# Example script to start up tunnel with autossh. | |
# | |
# This script will tunnel 12345 from the remote host | |
# to 12345 on the local host. | |
# | |
ID=login_here | |
HOST=destination.host.com | |
if [ "X$SSH_AUTH_SOCK" = "X" ]; then | |
eval `ssh-agent -s` | |
ssh-add $HOME/.ssh/id_rsa | |
fi | |
AUTOSSH_POLL=600 | |
AUTOSSH_PORT=20000 | |
AUTOSSH_GATETIME=30 | |
AUTOSSH_LOGFILE=$HOST.log | |
AUTOSSH_DEBUG=yes | |
AUTOSSH_PATH=/usr/bin/ssh | |
export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_DEBUG AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT | |
autossh -2 -fN -M 20000 -L 12345:localhost:12345 ${ID}@${HOST} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment