From 94b0936a143d0f2bb63e8a1a2aa7d5cd06d7cec3 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 23 Aug 2013 18:47:45 +0200 Subject: [PATCH] use start-stop-deamon in init scripts --- etc/init/pandora-cron.conf | 17 ++++++++++------- etc/init/pandora-encoding.conf | 19 +++++++++++-------- etc/init/pandora-tasks.conf | 19 +++++++++++-------- etc/init/pandora.conf | 17 ++++++++++------- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/etc/init/pandora-cron.conf b/etc/init/pandora-cron.conf index bd3cc9f6..309e08e5 100644 --- a/etc/init/pandora-cron.conf +++ b/etc/init/pandora-cron.conf @@ -12,13 +12,16 @@ env VENV=/srv/pandora env USER=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/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) -cd $VENV/pandora -exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celerybeat \ - -s /var/run/pandora/celerybeat-schedule \ - --pidfile /var/run/pandora/pandora-cron.pid \ - -f /var/log/pandora/pandora-cron.log \ - -l INFO end script + +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 \ + --pidfile /var/run/pandora/pandora-cron.pid \ + -f /var/log/pandora/pandora-cron.log \ + -l INFO diff --git a/etc/init/pandora-encoding.conf b/etc/init/pandora-encoding.conf index 167c9b80..81b4fdb4 100644 --- a/etc/init/pandora-encoding.conf +++ b/etc/init/pandora-encoding.conf @@ -12,14 +12,17 @@ env VENV=/srv/pandora env USER=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/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) -cd $VENV/pandora -exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \ - -Q encoding \ - -n pandora-encoding \ - --pidfile /var/run/pandora/pandora-encoding.pid \ - -f /var/log/pandora/pandora-encoding.log \ - -l INFO end script + +exec start-stop-daemon \ + --start -c $USER -d $VENV/pandora \ + -n pandora-encoding --exec $VENV/bin/python -- \ + $VENV/pandora/manage.py celeryd \ + -Q encoding \ + -n pandora-encoding \ + --pidfile /var/run/pandora/pandora-encoding.pid \ + -f /var/log/pandora/pandora-encoding.log \ + -l INFO diff --git a/etc/init/pandora-tasks.conf b/etc/init/pandora-tasks.conf index bf4a004d..7807a8b4 100644 --- a/etc/init/pandora-tasks.conf +++ b/etc/init/pandora-tasks.conf @@ -12,14 +12,17 @@ env VENV=/srv/pandora env USER=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/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) -cd $VENV/pandora -exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \ - -Q default,celery \ - -n pandora-default \ - --pidfile /var/run/pandora/pandora-tasks.pid \ - -f /var/log/pandora/pandora-tasks.log \ - -l INFO end script + +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 \ + -n pandora-default \ + --pidfile /var/run/pandora/pandora-tasks.pid \ + -f /var/log/pandora/pandora-tasks.log \ + -l INFO diff --git a/etc/init/pandora.conf b/etc/init/pandora.conf index 6c363957..9c8317b6 100644 --- a/etc/init/pandora.conf +++ b/etc/init/pandora.conf @@ -12,15 +12,18 @@ env VENV=/srv/pandora env USER=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/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora) cd $VENV/pandora /usr/bin/sudo -u $USER ./manage.py compile_pyc -exec /usr/bin/sudo -u $USER $VENV/bin/gunicorn_django \ - --bind 127.0.0.1:2620 \ - --timeout 90 \ - -p /var/run/pandora/pandora.pid \ - --log-level info --log-file /var/log/pandora/pandora.log \ - --workers 5 end script + +exec start-stop-daemon \ + --start -c $USER -d $VENV/pandora --exec \ + $VENV/bin/gunicorn_django -- \ + --bind 127.0.0.1:2620 \ + --timeout 90 \ + -p /var/run/pandora/pandora.pid \ + --log-level info --log-file /var/log/pandora/pandora.log \ + --workers 5