use start-stop-deamon in init scripts

This commit is contained in:
j 2013-08-23 18:47:45 +02:00
parent c942ac2b9b
commit 94b0936a14
4 changed files with 42 additions and 30 deletions

View file

@ -12,13 +12,16 @@ env VENV=/srv/pandora
env USER=pandora env USER=pandora
env HOME=/home/pandora env HOME=/home/pandora
script pre-start script
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora)
test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora)
cd $VENV/pandora end script
exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celerybeat \
exec start-stop-daemon \
--start -c $USER -d $VENV/pandora \
-n pandora-cron --exec $VENV/bin/python -- \
$VENV/pandora/manage.py celerybeat \
-s /var/run/pandora/celerybeat-schedule \ -s /var/run/pandora/celerybeat-schedule \
--pidfile /var/run/pandora/pandora-cron.pid \ --pidfile /var/run/pandora/pandora-cron.pid \
-f /var/log/pandora/pandora-cron.log \ -f /var/log/pandora/pandora-cron.log \
-l INFO -l INFO
end script

View file

@ -12,14 +12,17 @@ env VENV=/srv/pandora
env USER=pandora env USER=pandora
env HOME=/home/pandora env HOME=/home/pandora
script pre-start script
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora)
test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora)
cd $VENV/pandora end script
exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \
exec start-stop-daemon \
--start -c $USER -d $VENV/pandora \
-n pandora-encoding --exec $VENV/bin/python -- \
$VENV/pandora/manage.py celeryd \
-Q encoding \ -Q encoding \
-n pandora-encoding \ -n pandora-encoding \
--pidfile /var/run/pandora/pandora-encoding.pid \ --pidfile /var/run/pandora/pandora-encoding.pid \
-f /var/log/pandora/pandora-encoding.log \ -f /var/log/pandora/pandora-encoding.log \
-l INFO -l INFO
end script

View file

@ -12,14 +12,17 @@ env VENV=/srv/pandora
env USER=pandora env USER=pandora
env HOME=/home/pandora env HOME=/home/pandora
script pre-start script
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora)
test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora)
cd $VENV/pandora end script
exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \
exec start-stop-daemon \
--start -c $USER -d $VENV/pandora \
-n pandora-tasks --exec $VENV/bin/python -- \
$VENV/pandora/manage.py celeryd \
-Q default,celery \ -Q default,celery \
-n pandora-default \ -n pandora-default \
--pidfile /var/run/pandora/pandora-tasks.pid \ --pidfile /var/run/pandora/pandora-tasks.pid \
-f /var/log/pandora/pandora-tasks.log \ -f /var/log/pandora/pandora-tasks.log \
-l INFO -l INFO
end script

View file

@ -12,15 +12,18 @@ env VENV=/srv/pandora
env USER=pandora env USER=pandora
env HOME=/home/pandora env HOME=/home/pandora
script pre-start script
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora)
test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora)
cd $VENV/pandora cd $VENV/pandora
/usr/bin/sudo -u $USER ./manage.py compile_pyc /usr/bin/sudo -u $USER ./manage.py compile_pyc
exec /usr/bin/sudo -u $USER $VENV/bin/gunicorn_django \ end script
exec start-stop-daemon \
--start -c $USER -d $VENV/pandora --exec \
$VENV/bin/gunicorn_django -- \
--bind 127.0.0.1:2620 \ --bind 127.0.0.1:2620 \
--timeout 90 \ --timeout 90 \
-p /var/run/pandora/pandora.pid \ -p /var/run/pandora/pandora.pid \
--log-level info --log-file /var/log/pandora/pandora.log \ --log-level info --log-file /var/log/pandora/pandora.log \
--workers 5 --workers 5
end script