diff --git a/fabfile.py b/fabfile.py index 1dbd5a0..540351c 100644 --- a/fabfile.py +++ b/fabfile.py @@ -1,4 +1,5 @@ from __future__ import with_statement +import time from fabric.api import * env.repo = 'git://dev.dredd.it/dreddit-auth.git' @@ -137,4 +138,5 @@ def restart(): Restart the FCGI server """ stop() + time.sleep(2) start() diff --git a/start.sh b/start.sh index a820577..9c2d5c2 100755 --- a/start.sh +++ b/start.sh @@ -1,13 +1,16 @@ #!/bin/bash -PIDFILE='auth.pid' +ROOT=`pwd` +PIDFILE=$ROOT/logs/auth.pid + +mkdir logs 2> /dev/null if [ -f $PIDFILE ]; then - kill `cat -- $PIDFILE` + kill `cat -- $PIDFILE` 2> /dev/null rm -f -- $PIDFILE fi sleep 1 +cd $ROOT source ./env/bin/activate -./manage.py runfcgi daemonize=false pidfile=$PIDFILE host=127.0.0.1 port=9981 & -exit 0 +./manage.py runfcgi daemonize=true pidfile=$PIDFILE host=127.0.0.1 port=9981 errlog=$ROOT/logs/stderr.log outlog=$ROOT/logs/stdout.log