From: Chris Koeritz Date: Sun, 14 Apr 2013 15:26:00 +0000 (-0400) Subject: yes, working nicely, plus now we're guarding against running the same tunnel X-Git-Tag: 2.140.90~1015 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=f8d40c0f02ba24f748c6bfd9a31dd6c19b2ebf9d;p=feisty_meow.git yes, working nicely, plus now we're guarding against running the same tunnel twice based on its screen name. --- diff --git a/scripts/security/screened_tunneler.sh b/scripts/security/screened_tunneler.sh index 8e855bff..e8fb61cd 100755 --- a/scripts/security/screened_tunneler.sh +++ b/scripts/security/screened_tunneler.sh @@ -111,6 +111,13 @@ if [ $LAUNCHING_TUNNEL -eq 1 ]; then # loop does not exit on its own. else # this version re-launches the script but tells it to start the tunnel. + existingScreens="$(screen -ls | grep "$TUNNEL_SCREEN_NAME")" + if [ ! -z "$existingScreens" ]; then + echo "This script is already running a screen for: $TUNNEL_SCREEN_NAME" + echo "Connect to that and zap it first before we try to start a new one," + echo "e.g.: screen -r -S \"$TUNNEL_SCREEN_NAME\"" + exit 1 + fi screen -L -S "$TUNNEL_SCREEN_NAME" -d -m bash $0 "$TUNNEL_USER_PLUS_HOST" "$TUNNEL_LINK" "$TUNNEL_SCREEN_NAME" "$TUNNEL_SECURITY_KEY" go fi