Created
January 28, 2012 10:21
-
-
Save charlestang/1693862 to your computer and use it in GitHub Desktop.
This script is for OS X. It check if the ssh forwording process exists, if not, create one. It is created for adding to crontab.
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 | |
listen=`netstat -f inet -p tcp -nRa | grep 'LISTEN' | awk '{ print $4 }' | grep 10024` | |
if [ $listen ]; then | |
if [ $listen = '127.0.0.1.10024' ]; then | |
exit | |
fi | |
fi | |
nohup ssh -ntt -D 10024 user@yourdomain.com > /dev/null 2>&1 & | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment