trying to make my django site as service. Here is the code:
DIR=/home/karonator/pk-akr
DAEMON=$DIR/manage.py
DAEMON_NAME=somename
DAEMON_OPTS="runserver 0.0.0.0:7777"
DAEMON_USER=karonator
PIDFILE=/var/run/$DAEMON_NAME.pid
. /lib/lsb/init-functions
do_start () {
log_daemon_msg "Starting system $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --exec /usr/bin/python $DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
This works but start-stop-daemon spawning two processes:
Any ideas how to fix it? As the result the stop and restart functions not works correctly.