Created
August 20, 2010 18:12
-
-
Save TimFletcher/540838 to your computer and use it in GitHub Desktop.
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 | |
# 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=12 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment