Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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