Created
March 19, 2012 10:12
-
-
Save level09/2106376 to your computer and use it in GitHub Desktop.
Upstart Script for Gunicorn Django + bash script
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
description "Test Django instance" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
respawn limit 10 5 | |
exec /path/to/test/hello/script.sh | |
#!/bin/bash | |
set -e | |
LOGFILE=/var/log/gunicorn/hello.log | |
LOGDIR=$(dirname $LOGFILE) | |
#set how many workers here | |
NUM_WORKERS=3 | |
# user/group to run as | |
USER=your_unix_user | |
GROUP=your_unix_group | |
cd /path/to/test/hello | |
#remove if not using virtualenv | |
source ../bin/activate | |
#check that log dir exists | |
test -d $LOGDIR || mkdir -p $LOGDIR | |
exec ../bin/gunicorn_django -w $NUM_WORKERS \ | |
--user=$USER --group=$GROUP --log-level=debug \ | |
--log-file=$LOGFILE 2>>$LOGFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment