Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 56 lines (48 sloc) 1.22 KB
#! /bin/sh
### BEGIN INIT INFO
# Provides: application-django-mapit
# Required-Start: $local_fs $network postgresql
# Required-Stop: $local_fs $network postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the gunicorn server for MapIt
# Description: The gunicorn server for MapIt
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
SITE_HOME=/var/www/mapit
NAME=mapit
DESC="MapIt app server"
USER=mapit-user
echo $DAEMON
test -f $DAEMON || exit 0
set -e
start_daemon() {
cd $SITE_HOME/mapit && ../virtualenv-mapit/bin/python /usr/bin/gunicorn project.wsgi:application \
--user=$USER \
--group=$USER \
-D \
--log-file=$SITE_HOME/logs/gunicorn.log \
-b 127.0.0.1:8000
}
stop_daemon() {
pkill -f gunicorn || true
}
case "$1" in
start)
start_daemon
;;
stop)
stop_daemon
;;
reload|restart|force-reload)
stop_daemon
sleep 5
start_daemon
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac
exit 0