Created
October 15, 2016 14:48
-
-
Save vay3t/b88bead0e16b91387c8ba3c5c75f187b 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/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