devstack/rejoin-stack.sh
Nikolay Fedotov 7f66503de0 Use SCREEN_NAME variable instead of hardcode in unstack and rejoin scripts
Change-Id: I7382eccf96d14df223777cd43344d554b8452a77
2016-02-25 14:03:19 +00:00

26 lines
653 B
Bash
Executable File

#! /usr/bin/env bash
# This script rejoins an existing screen, or re-creates a
# screen session from a previous run of stack.sh.
TOP_DIR=`dirname $0`
# Import common functions in case the localrc (loaded via stackrc)
# uses them.
source $TOP_DIR/functions
source $TOP_DIR/stackrc
SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc
# if screenrc exists, run screen
if [[ -e $SCREENRC ]]; then
if screen -ls | egrep -q "[0-9]+.${SCREEN_NAME}"; then
echo "Attaching to already started screen session.."
exec screen -r $SCREEN_NAME
fi
exec screen -c $SCREENRC
fi
echo "Couldn't find $SCREENRC file; have you run stack.sh yet?"
exit 1