Restart openstack services after running stack.sh

* Added screen_rc function in stack.sh to save started services to stack-screenrc file
* Added rejoin-stack.sh to rejoin the current screen session or start a new session

Change-Id: I381a7832bc8a107bfbd51c5ecfbd2e9134cf0a0a
blueprint: restart-services
diff --git a/rejoin-stack.sh b/rejoin-stack.sh
new file mode 100755
index 0000000..a82c73c
--- /dev/null
+++ b/rejoin-stack.sh
@@ -0,0 +1,18 @@
+#! /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`
+
+# if screenrc exists, run screen
+if [[ -e $TOP_DIR/stack-screenrc ]]; then
+    if screen -ls | egrep -q "[0-9].stack"; then
+        echo "Attaching to already started screen session.."
+        exec screen -r stack
+    fi
+    exec screen -c $TOP_DIR/stack-screenrc
+fi
+
+echo "Couldn't find $TOP_DIR/stack-screenrc file; have you run stack.sh yet?"
+exit 1