Skip to content

Instantly share code, notes, and snippets.

@kmskrishna
Created November 18, 2015 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmskrishna/80bbb46739fa08f9f541 to your computer and use it in GitHub Desktop.
Save kmskrishna/80bbb46739fa08f9f541 to your computer and use it in GitHub Desktop.
SSH Tunnel Oh My Fish shell (Copy this into fish config fle)
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