diff --git a/rejoin-stack.sh b/rejoin-stack.sh index 30b7bab1cc..7048865fc9 100755 --- a/rejoin-stack.sh +++ b/rejoin-stack.sh @@ -11,14 +11,15 @@ source $TOP_DIR/functions source $TOP_DIR/stackrc +SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc # if screenrc exists, run screen -if [[ -e $TOP_DIR/stack-screenrc ]]; then - if screen -ls | egrep -q "[0-9].stack"; then +if [[ -e $SCREENRC ]]; then + if screen -ls | egrep -q "[0-9]+.${SCREEN_NAME}"; then echo "Attaching to already started screen session.." - exec screen -r stack + exec screen -r $SCREEN_NAME fi - exec screen -c $TOP_DIR/stack-screenrc + exec screen -c $SCREENRC fi -echo "Couldn't find $TOP_DIR/stack-screenrc file; have you run stack.sh yet?" +echo "Couldn't find $SCREENRC file; have you run stack.sh yet?" exit 1 diff --git a/unstack.sh b/unstack.sh index d7670e38a5..7a7c945c8a 100755 --- a/unstack.sh +++ b/unstack.sh @@ -182,7 +182,7 @@ fi # Clean up the remainder of the screen processes SCREEN=$(which screen) if [[ -n "$SCREEN" ]]; then - SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }') + SESSION=$(screen -ls | awk "/[0-9]+.${SCREEN_NAME}/"'{ print $1 }') if [[ -n "$SESSION" ]]; then screen -X -S $SESSION quit fi