1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
From: Michael Fladischer <fladi@debian.org>
Date: Thu, 8 Oct 2015 08:37:02 -0700
Subject: 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 | 13 +++++++++++++
extra/generic-init.d/celeryd | 11 +++++++++++
2 files changed, 24 insertions(+)
diff --git a/extra/generic-init.d/celerybeat b/extra/generic-init.d/celerybeat
index b554844..b34eb25 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}."
@@ -90,6 +94,7 @@ _config_sanity() {
scripts=""
+
if test -f /etc/default/celeryd; then
scripts="/etc/default/celeryd"
_config_sanity /etc/default/celeryd
@@ -118,6 +123,14 @@ CELERYBEAT_LOG_LEVEL=${CELERYBEAT_LOG_LEVEL:-${CELERYBEAT_LOGLEVEL:-$DEFAULT_LOG
CELERYBEAT_SU=${CELERYBEAT_SU:-"su"}
CELERYBEAT_SU_ARGS=${CELERYBEAT_SU_ARGS:-""}
+DEFAULT_ENABLED="false"
+
+ENABLED=${ENABLED:-$DEFAULT_ENABLED}
+if [ "$ENABLED" != "true" ]; then
+ echo "celerybeat daemon disabled - see $scripts."
+ exit 0
+fi
+
# Sets --app argument for CELERY_BIN
CELERY_APP_ARG=""
if [ ! -z "$CELERY_APP" ]; then
diff --git a/extra/generic-init.d/celeryd b/extra/generic-init.d/celeryd
index 13fddde..2ef11fd 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
#
#
@@ -27,6 +28,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
@@ -56,6 +60,7 @@ DEFAULT_LOG_FILE="/var/log/celery/%n%I.log"
DEFAULT_LOG_LEVEL="INFO"
DEFAULT_NODES="celery"
DEFAULT_CELERYD="-m celery worker --detach"
+DEFAULT_ENABLED="false"
if [ -d "/etc/default" ]; then
CELERY_CONFIG_DIR="/etc/default"
@@ -114,6 +119,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
|