Created
November 18, 2015 17:02
-
-
Save kmskrishna/80bbb46739fa08f9f541 to your computer and use it in GitHub Desktop.
SSH Tunnel Oh My Fish shell (Copy this into fish config fle)
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
function connect | |
set running (ps aux | grep ssh | grep 3128 -c) | |
if test $running -ne 0 | |
disconnect | |
end | |
sshpass -p fucksociety ssh -f group23@172.16.112.136 -L 8080:202.141.80.24:3128 -N | |
echo "Connected" | |
end | |
function isconnected | |
set running (ps aux | grep ssh | grep 3128 -c) | |
if [ $running = 1 ] | |
echo "Connected" | |
else | |
echo "Not connected" | |
end | |
end | |
function disconnect | |
set running (ps aux | grep ssh | grep 3128 -c) | |
if [ $running = 0 ] | |
echo "Disconnected all existing connections" | |
else | |
ps aux | grep ssh | grep 3128 | awk '{print $2}' | xargs kill | |
echo "Disconnected all existing connections" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment