Created
October 27, 2014 15:44
-
-
Save RaphaelAudet/e50e90ca92160c010ab0 to your computer and use it in GitHub Desktop.
Monit wrapper script for FOREVER running GHOST
This file contains hidden or 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/bash | |
export NODE_ENV=production | |
NAME="ghost-$NODE_ENV" | |
USER="node" | |
APP_ROOT="/var/www/ghost" | |
PID_FILE="/var/www/ghost/$NAME.pid " | |
export PATH=$PATH: | |
case $1 in | |
start) | |
/bin/su - $USER -c "cd $APP_ROOT && NODE_ENV=production forever start --uid=$NAME --pidFile=$PID_FILE -a -l $APP_ROOT/$NAME.log index.js" | |
;; | |
stop) | |
/bin/su - $USER -c "cd $APP_ROOT && NODE_ENV=production forever stop --uid=$NAME" | |
;; | |
status) | |
cat $PID_FILE | |
;; | |
*) | |
echo "usage: xyz {start|stop|status}" ;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment