File: lsb-init.patch

package info (click to toggle)
celery 4.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,136 kB
  • sloc: python: 47,677; sh: 772; makefile: 226
file content (101 lines) | stat: -rw-r--r-- 2,991 bytes parent folder | download
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
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 | 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 8f97790..fc14ce1 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
@@ -111,6 +116,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 1636619..67dd55d 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