Created
December 15, 2014 20:19
-
-
Save anthonywu/04b06da03115be26afab to your computer and use it in GitHub Desktop.
ssh tunnel management
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
# check for running ssh processes that look like tunneling processes | |
ps -eo command | grep "ssh.*\-[L] .*/.*/.*" || echo "No Existing Tunnels" | |
# This script closes all ssh processes that look like local tunnels | |
for pid in $(ps -ef | grep "[s]sh.*-L" | awk '{ print $2 }'); do | |
kill -TERM $pid; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment