Last active
January 14, 2016 10:53
-
-
Save klcodanr/4459175 to your computer and use it in GitHub Desktop.
Shell script for Jekyll to loaded on server load.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# jekyll Starts and stops Jekyll | |
# | |
# | |
# chkconfig: - 85 15 | |
# description: Jekyll is a Ruby based website caching engine | |
# processname: jekyll | |
# pidfile: /var/run/jekyll.pid | |
# Configure your values here | |
SOURCE=/opt/dev/mysitecode | |
DEST=/var/www/html | |
# Generally, shouldn't need to change below here... | |
PID_FILE=/var/run/jekyll.pid | |
LOG_FILE=/var/log/jekyll.log | |
JEKYLL_EXE=/usr/local/bin/jekyll | |
case "$1" in | |
start) | |
$JEKYLL_EXE $SOURCE $DEST >> $LOG_FILE & | |
echo $! > $PID_FILE | |
echo "Jekyll STARTED" | |
exit 0 | |
;; | |
stop) | |
kill -TERM $(cat $PID_FILE) | |
echo "Jekyll STOPPED" | |
exit 0 | |
;; | |
restart) | |
$0 stop | |
$0 start | |
exit 0 | |
;; | |
status) | |
ps -p `cat $PID_FILE` > /dev/null 2>&1 && echo "Jekyll Running" || echo "Jekyll Not Running" | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment