Last active
January 31, 2016 13:19
-
-
Save channprj/695f8216aabd81c12255 to your computer and use it in GitHub Desktop.
Ghost blog booting script with forever package.
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 | |
### BEGIN INIT INFO | |
# Provides: blog | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
### END INIT INFO | |
USER="blog" | |
APP="/home/blog/ghost/index.js" | |
LOG="/var/log/ghost/server.log" | |
stop() { | |
sudo su - $USER -c "source ~/.zshrc; NODE_ENV=production forever stop $APP;" | |
# sudo su - $USER -c "NODE_ENV=production forever stop $APP" | |
} | |
start() { | |
sudo su - $USER -c "source ~/.zshrc; NODE_ENV=production forever start --append -l $LOG -o $LOG -e $LOG $APP;" | |
# sudo su - $USER -c "NODE_ENV=production forever start --append -l $LOG -o $LOG -e $LOG $APP" | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment