Skip to content

Instantly share code, notes, and snippets.

@orangejulius
Created September 24, 2013 05:47
Show Gist options
  • Save orangejulius/6680817 to your computer and use it in GitHub Desktop.
Save orangejulius/6680817 to your computer and use it in GitHub Desktop.
#!/bin/bash
createTunnel() {
/usr/bin/ssh -f -N -R 10022:localhost:22 -L19922:juliansimioni.com:27823 juliansimioni.com
if [[ $? -eq 0 ]]; then
echo Tunnel to hostb created successfully
else
echo An error occurred creating a tunnel to hostb RC was $?
fi
}
/usr/bin/ssh -p 19922 localhost ls
if [[ $? -ne 0 ]]; then
echo Creating new tunnel connection
createTunnel
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment