Use SCREEN_NAME variable instead of hardcode in unstack and rejoin scripts

Change-Id: I7382eccf96d14df223777cd43344d554b8452a77
This commit is contained in:
Nikolay Fedotov 2016-02-24 16:07:18 +00:00
parent 0515ff0912
commit 7f66503de0
2 changed files with 7 additions and 6 deletions

View File

@ -11,14 +11,15 @@ source $TOP_DIR/functions
source $TOP_DIR/stackrc source $TOP_DIR/stackrc
SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc
# if screenrc exists, run screen # if screenrc exists, run screen
if [[ -e $TOP_DIR/stack-screenrc ]]; then if [[ -e $SCREENRC ]]; then
if screen -ls | egrep -q "[0-9].stack"; then if screen -ls | egrep -q "[0-9]+.${SCREEN_NAME}"; then
echo "Attaching to already started screen session.." echo "Attaching to already started screen session.."
exec screen -r stack exec screen -r $SCREEN_NAME
fi fi
exec screen -c $TOP_DIR/stack-screenrc exec screen -c $SCREENRC
fi 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 exit 1

View File

@ -182,7 +182,7 @@ fi
# Clean up the remainder of the screen processes # Clean up the remainder of the screen processes
SCREEN=$(which screen) SCREEN=$(which screen)
if [[ -n "$SCREEN" ]]; then 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 if [[ -n "$SESSION" ]]; then
screen -X -S $SESSION quit screen -X -S $SESSION quit
fi fi