Browse Source

Merge branch '66laps/master'

Ask Solem 14 years ago
parent
commit
66743a6782
3 changed files with 46 additions and 10 deletions
  1. 14 4
      contrib/debian/init.d/celerybeat
  2. 16 3
      contrib/debian/init.d/celeryd
  3. 16 3
      contrib/debian/init.d/celeryevcam

+ 14 - 4
contrib/debian/init.d/celerybeat

@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 # =========================================================
 #  celerybeat - Starts the Celery periodic task scheduler.
 # =========================================================
@@ -39,10 +39,10 @@
 #   CELERYD="/opt/Project/manage.py celeryd"
 #
 #   # Path to celerybeat
-#   CELERYBEAT="/opt/Project/manage.py celerybeat"
+#   CELERYBEAT="/opt/Project/manage.py"
 #
 #   # Extra arguments to celerybeat
-#   CELERYBEAT_OPTS="--schedule=/var/run/celerybeat-schedule"
+#   CELERYBEAT_OPTS="celerybeat --schedule=/var/run/celerybeat-schedule"
 #
 # AVAILABLE OPTIONS
 # =================
@@ -69,7 +69,9 @@
 #
 #   * CELERYBEAT_GROUP
 #       Group to run celeryd as. Default is current user.
-
+#
+#   * VIRTUALENV
+#       Full path to the virtualenv environment to activate. Default is none.
 
 ### BEGIN INIT INFO
 # Provides:          celerybeat
@@ -108,6 +110,11 @@ if [ -n "$2" ]; then
     CELERYBEAT_OPTS="$CELERYBEAT_OPTS $2"
 fi
 
+# Append the Django settings module to use, if specified
+if [ -n "$DJANGO_SETTINGS_MODULE" ]; then
+    CELERYBEAT_OPTS="$CELERYBEAT_OPTS --settings=$DJANGO_SETTINGS_MODULE"
+fi
+
 # Extra start-stop-daemon options, like user/group.
 if [ -n "$CELERYBEAT_USER" ]; then
     DAEMON_OPTS="$DAEMON_OPTS --chuid $CELERYBEAT_USER"
@@ -165,6 +172,9 @@ start_worker () {
                            $* \
                            --pidfile $CELERYBEAT_PID_FILE
                            --exec $CELERYBEAT -- $CELERYBEAT_OPTS"
+    if [ -n "$VIRTUALENV" ]; then
+        source $VIRTUALENV/bin/activate
+    fi
     if $cmd; then
         log_end_msg 0
     else

+ 16 - 3
contrib/debian/init.d/celeryd

@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 # ============================================
 #  celeryd - Starts the Celery worker daemon.
 # ============================================
@@ -35,7 +35,10 @@
 #   DJANGO_SETTINGS_MODULE="settings"
 #
 #   # Path to celeryd
-#   CELERYD="/opt/Project/manage.py celeryd"
+#   CELERYD="/opt/Project/manage.py"
+#
+#   # Extra arguments to manage.py
+#   CELERYD_OPTS="celeryd"
 #
 # AVAILABLE OPTIONS
 # =================
@@ -64,7 +67,9 @@
 #
 #   * CELERYD_GROUP
 #       Group to run celeryd as. Default is current user.
-
+#
+#   * VIRTUALENV
+#       Full path to the virtualenv environment to activate. Default is none.
 
 ### BEGIN INIT INFO
 # Provides:          celeryd
@@ -101,6 +106,11 @@ if [ -n "$2" ]; then
     CELERYD_OPTS="$CELERYD_OPTS $2"
 fi
 
+# Append the Django settings module to use, if specified
+if [ -n "$DJANGO_SETTINGS_MODULE" ]; then
+    CELERYD_OPTS="$CELERYD_OPTS --settings=$DJANGO_SETTINGS_MODULE"
+fi
+
 # Extra start-stop-daemon options, like user/group.
 if [ -n "$CELERYD_USER" ]; then
     DAEMON_OPTS="$DAEMON_OPTS --chuid $CELERYD_USER"
@@ -157,6 +167,9 @@ start_worker () {
                            $* \
                            --pidfile $CELERYD_PID_FILE
                            --exec $CELERYD -- $CELERYD_OPTS"
+    if [ -n "$VIRTUALENV" ]; then
+        source $VIRTUALENV/bin/activate
+    fi
     if $cmd; then
         log_end_msg 0
     else

+ 16 - 3
contrib/debian/init.d/celeryevcam

@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 # ============================================
 #  celeryd - Starts the Celery worker daemon.
 # ============================================
@@ -38,7 +38,10 @@
 #   DJANGO_SETTINGS_MODULE="settings"
 #
 #   # Path to celeryd
-#   CELERYEV="/opt/Project/manage.py celeryev"
+#   CELERYEV="/opt/Project/manage.py"
+#
+#   # Extra arguments to manage.py
+#   CELERYEV_OPTS="celeryev"
 #
 #   # Camera class to use (required)
 #   CELERYEV_CAM = "djcelery.snapshot.Camera"
@@ -70,7 +73,9 @@
 #
 #   * CELERYEV_GROUP
 #       Group to run celeryev as. Default is current user.
-
+#
+#   * VIRTUALENV
+#       Full path to the virtualenv environment to activate. Default is none.
 
 ### BEGIN INIT INFO
 # Provides:          celeryev
@@ -118,6 +123,11 @@ if [ -n "$2" ]; then
     CELERYEV_OPTS="$CELERYEV_OPTS $2"
 fi
 
+# Append the Django settings module to use, if specified
+if [ -n "$DJANGO_SETTINGS_MODULE" ]; then
+    CELERYEV_OPTS="$CELERYEV_OPTS --settings=$DJANGO_SETTINGS_MODULE"
+fi
+
 # Extra start-stop-daemon options, like user/group.
 if [ -n "$CELERYEV_USER" ]; then
     DAEMON_OPTS="$DAEMON_OPTS --chuid $CELERYEV_USER"
@@ -176,6 +186,9 @@ start_evcam () {
                            $* \
                            --pidfile $CELERYEV_PID_FILE
                            --exec $CELERYEV -- $CELERYEV_OPTS"
+    if [ -n "$VIRTUALENV" ]; then
+        source $VIRTUALENV/bin/activate
+    fi
     if $cmd; then
         log_end_msg 0
     else