Skip to content

Instantly share code, notes, and snippets.

@oowekyala
Created August 23, 2017 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oowekyala/ee6f8801138861072c59ce683bdf737b to your computer and use it in GitHub Desktop.
Save oowekyala/ee6f8801138861072c59ce683bdf737b to your computer and use it in GitHub Desktop.
Simple screen launcer for the PMD jekyll site
#!/bin/bash
# Assuming GNU screen and bundler are installed, and `bundle install` has been run,
# this script starts the PMD documentation site server as a background screen.
# Kill the screen with option -k or --kill
# Install: change the PMD_GIT_DIR to match your pmd working directory, put in path and make executable
PMD_GIT_DIR="$HOME/Documents/Git/pmd"
SCRIPT_NAME=$(basename $0)
case "$1" in
"--kill" | "-k")
if screen -list | grep -q "$SCRIPT_NAME"; then
screen -X -S "$SCRIPT_NAME" quit
fi
exit 0
;;
"--resume" | "-r")
if screen -list | grep -q "$SCRIPT_NAME"; then
screen -r "$SCRIPT_NAME"
fi
esac
if ! screen -list | grep -q "$SCRIPT_NAME"; then
cd "$PMD_GIT_DIR/docs"
screen -S "$SCRIPT_NAME" -d -m -- bundler exec jekyll serve
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment