Last active
August 29, 2015 14:12
-
-
Save asachs01/90f33273072bdb0c5222 to your computer and use it in GitHub Desktop.
Ghost.io Init Script for CentOS
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 | |
# | |
# Note runlevel 2345, 86 is the Start order and 85 is the Stop order | |
# | |
# chkconfig: 2345 86 85 | |
# description: Start/Stop/Restart Ghost | |
# | |
# Below is the source function library, leave it be | |
. /etc/init.d/functions | |
# result of whereis forever or whereis node | |
export PATH=$PATH:/usr/local/bin | |
# result of whereis node_modules | |
export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules | |
start(){ | |
NODE_ENV=production forever start /path/to/your/ghost/index.js | |
} | |
stop(){ | |
NODE_ENV=production forever stop /path/to/your/ghost/index.js | |
} | |
restart(){ | |
NODE_ENV=production forever restart /path/to/your/ghost/index.js | |
} | |
case "$1" in | |
start) | |
echo "Start service SERVICE_NAME" | |
start | |
;; | |
stop) | |
echo "Stop service SERVICE_NAME" | |
stop | |
;; | |
restart) | |
echo "Restart service SERVICE_NAME" | |
restart | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
exit 1 | |
;; | |
esac | |
# Adapted from Aron Duby http://aronduby.com/starting-node-forever-scripts-at-boot-w-centos/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment