Skip to content

Instantly share code, notes, and snippets.

@vay3t
Created October 15, 2016 14:48
Show Gist options
  • Save vay3t/b88bead0e16b91387c8ba3c5c75f187b to your computer and use it in GitHub Desktop.
Save vay3t/b88bead0e16b91387c8ba3c5c75f187b to your computer and use it in GitHub Desktop.
#!/bin/bash
createTunnel() {
/usr/bin/ssh -N -R 2222:localhost:22 serverUser@25.25.25.25
if [[ $? -eq 0 ]]; then
echo Tunnel to jumpbox created successfully
else
echo An error occurred creating a tunnel to jumpbox. RC was $?
fi
}
/bin/pidof ssh
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