Created
March 28, 2013 02:04
-
-
Save NorthIsUp/5259916 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
#!/usr/bin/env bash | |
# Create a ssh tunnel to an ip for port or service | |
function tunnel (){ | |
case "$2" in | |
"-h" | "--help" | "help") | |
echo "usage: $0 <service|port> ip" | |
echo "supported services:" | |
echo " psql, mysql" | |
;; | |
"psql") | |
ssh $1 -L 5434:127.0.0.1:5432 | |
;; | |
"mysql") | |
ssh $1 -L 3306:127.0.0.1:3306 | |
;; | |
*) | |
ssh $1 -L $2:127.0.0.1$2 | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment