Created
September 21, 2010 01:43
Revisions
-
TimFletcher created this gist
Sep 21, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ #!/bin/sh # You must have your virtualenv activated to run this script NAME=gunicorn_timothyfletcher PID=/home/fire/www/timothyfletcher.com/conf/gunicorn.pid SETTINGS=/home/fire/www/timothyfletcher.com/timothyfletcher/settings.py LOGFILE=/home/fire/www/timothyfletcher.com/logs/gunicorn.log WORKERS=8 BIND_ADDRESS=127.0.0.1:8000 RETVAL=0 start() { echo "Starting $NAME..." gunicorn_django --name $NAME --pid $PID --workers=$WORKERS --bind=$BIND_ADDRESS --log-file=$LOGFILE --daemon $SETTINGS && echo "Gunicorn started" || echo "Failed"; } stop() { echo "Stopping $NAME with PID `cat $PID`..." kill -QUIT `cat $PID` && echo "Gunicorn stopped" || echo "Failed"; } reload() { echo "Reloading $NAME..." if [ -f $PID ] then kill -HUP `cat $PID` && echo "Gunicorn reloaded" || echo "Failed"; fi } case "$1" in start) start ;; stop) stop ;; restart) reload ;; reload) reload ;; force-reload) stop && start ;; *) echo $"Usage: $0 {start|stop|restart}" RETVAL=1 esac exit $RETVAL