[Python-modules-commits] [celery] 03/11: LSB compliant headers, status actions and ENABLED variable

Brian May bam at moszumanska.debian.org
Wed Nov 18 22:21:06 UTC 2015


This is an automated email from the git hooks/post-receive script.

bam pushed a commit to branch master
in repository celery.

commit 0e7ca21f39a76cc231dbc37e9aaeb10d3cc6e428
Author: Michael Fladischer <fladi at debian.org>
Date:   Thu Oct 8 08:37:02 2015 -0700

    LSB compliant headers, status actions and ENABLED variable
    
     Upstream ships it's own init scripts but they lack some LSB header and
     the (optional) "status" action. This patch fixes this and also adds a
     variable called ENABLED in /etc/default/celeryd.
    Last-Update: 2013-09-03
    Forwarded: no
    
    Patch-Name: lsb-init.patch
---
 extra/generic-init.d/celerybeat | 12 ++++++++++++
 extra/generic-init.d/celeryd    | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/extra/generic-init.d/celerybeat b/extra/generic-init.d/celerybeat
index fb31ca2..08bfbe4 100755
--- a/extra/generic-init.d/celerybeat
+++ b/extra/generic-init.d/celerybeat
@@ -15,11 +15,15 @@
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: celery periodic task scheduler
+# Description:       Controls the Celery periodic task scheduler.
 ### END INIT INFO
 
 # Cannot use set -e/bash -e since the kill -0 command will abort
 # abnormally in the absence of a valid process ID.
 #set -e
+
+. /lib/lsb/init-functions
+
 VERSION=10.1
 echo "celery init v${VERSION}."
 
@@ -85,6 +89,7 @@ _config_sanity() {
 
 scripts=""
 
+
 if test -f /etc/default/celeryd; then
     scripts="/etc/default/celeryd"
     _config_sanity /etc/default/celeryd
@@ -106,6 +111,13 @@ DEFAULT_PID_FILE="/var/run/celery/beat.pid"
 DEFAULT_LOG_FILE="/var/log/celery/beat.log"
 DEFAULT_LOG_LEVEL="INFO"
 DEFAULT_CELERYBEAT="$CELERY_BIN beat"
+DEFAULT_ENABLED="false"
+
+ENABLED=${ENABLED:-$DEFAULT_ENABLED}
+if [ "$ENABLED" != "true" ]; then
+    echo "celerybeat daemon disabled - see $scripts."
+    exit 0
+fi
 
 CELERYBEAT=${CELERYBEAT:-$DEFAULT_CELERYBEAT}
 CELERYBEAT_LOG_LEVEL=${CELERYBEAT_LOG_LEVEL:-${CELERYBEAT_LOGLEVEL:-$DEFAULT_LOG_LEVEL}}
diff --git a/extra/generic-init.d/celeryd b/extra/generic-init.d/celeryd
index 8cef473..509e639 100755
--- a/extra/generic-init.d/celeryd
+++ b/extra/generic-init.d/celeryd
@@ -16,6 +16,7 @@
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: celery task worker daemon
+# Description:       Controls a celery task worker daemon instance
 ### END INIT INFO
 #
 #
@@ -28,6 +29,9 @@
 #
 # You can then configure this by manipulating /etc/default/little-worker.
 #
+
+. /lib/lsb/init-functions
+
 VERSION=10.1
 echo "celery init v${VERSION}."
 if [ $(id -u) -ne 0 ]; then
@@ -52,6 +56,7 @@ DEFAULT_LOG_FILE="/var/log/celery/%n.log"
 DEFAULT_LOG_LEVEL="INFO"
 DEFAULT_NODES="celery"
 DEFAULT_CELERYD="-m celery worker --detach"
+DEFAULT_ENABLED="false"
 
 CELERY_DEFAULTS=${CELERY_DEFAULTS:-"/etc/default/${SCRIPT_NAME}"}
 
@@ -104,6 +109,12 @@ if [ -f "$CELERY_DEFAULTS" ]; then
     . "$CELERY_DEFAULTS"
 fi
 
+ENABLED=${ENABLED:-$DEFAULT_ENABLED}
+if [ "$ENABLED" != "true" ]; then
+    echo "celery daemon disabled - see $CELERY_DEFAULTS"
+    exit 0
+fi
+
 # Sets --app argument for CELERY_BIN
 CELERY_APP_ARG=""
 if [ ! -z "$CELERY_APP" ]; then

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/celery.git



More information about the Python-modules-commits mailing list