Commit ecc98ee6f04fadf1b6fde2d0dbc2b9b225bb4cea
1 parent
d9f567c7
Exists in
master
and in
39 other branches
Updating supervisor
Showing
8 changed files
with
422 additions
and
223 deletions
Show diff stats
... | ... | @@ -0,0 +1,9 @@ |
1 | +name 'seocam-supervisor' | |
2 | +version '0.0.1' | |
3 | +source 'https://github.com/TracyWebTech/puppet-supervisor' | |
4 | +author 'Tracy Web Technologies' | |
5 | +summary 'Install and configure Supervisord' | |
6 | +description "This puppet module is used to install and configure Supervisord. It also provides a custom define to manage services (apps) using it." | |
7 | +project_page 'https://github.com/TracyWebTech/puppet-supervisor' | |
8 | + | |
9 | +#dependency 'puppetlabs/stdlib', '>= 2.2.1' | ... | ... |
puppet/modules/supervisor/README.md
... | ... | @@ -16,9 +16,12 @@ Install your app using defined type supervisor::app |
16 | 16 | |
17 | 17 | ```puppet |
18 | 18 | supervisor::app { 'your-app-title': |
19 | - app_name => 'your-app-name' # Default to 'your-app-title' | |
20 | - command => 'The command that will be run this app', # required | |
21 | - directory => 'Path where your command will be run' # required | |
22 | - user => 'User to execute this app' # Default to ubuntu | |
19 | + app_name => 'your-app-name' # Default to 'your-app-title' | |
20 | + command => 'The command that will be run this app', # required | |
21 | + directory => 'Path where your command will be run' # required | |
22 | + user => 'User to execute this app' # Default to ubuntu | |
23 | + startsecs => 'The total number of seconds which the program needs to stay running after a startup to consider the start successful' # Default to undef | |
24 | + stopwaitsecs => 'The number of seconds to wait for the OS to return a SIGCHILD to supervisord after the program has been sent a stopsignal', # Default to undef | |
25 | + priority => 'The relative priority of the program in the start and shutdown ordering' # Default to undef | |
23 | 26 | } |
24 | -``` | |
25 | 27 | \ No newline at end of file |
28 | +``` | ... | ... |
puppet/modules/supervisor/files/debian-isnok
... | ... | @@ -1,217 +0,0 @@ |
1 | -#! /bin/sh | |
2 | -# | |
3 | -# supervisor built from skeleton /etc/init.d/ script. | |
4 | -# | |
5 | -# skeleton by Miquel van Smoorenburg <miquels@cistron.nl>. | |
6 | -# Modified for Debian by Ian Murdock <imurdock@gnu.ai.mit.edu>. | |
7 | -# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>. | |
8 | -# More changes by Konstantin Martini <isnok@tuxcode.org>. | |
9 | -# | |
10 | -# Version: @(#)supervisor 0.8 25-Jun-2013 isnok@tuxcode.org | |
11 | -# | |
12 | -### BEGIN INIT INFO | |
13 | -# Provides: supervisor | |
14 | -# Required-Start: $remote_fs $network $named | |
15 | -# Required-Stop: $remote_fs $network $named | |
16 | -# Default-Start: 2 3 4 5 | |
17 | -# Default-Stop: 0 1 6 | |
18 | -# Short-Description: Start/stop supervisord | |
19 | -# Description: Start/stop supervisor daemon and its configured | |
20 | -# subprocesses. | |
21 | -### END INIT INFO | |
22 | - | |
23 | - | |
24 | -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
25 | -#DAEMON=/usr/bin/supervisord # Debian package version (presently 3.0a8-1) | |
26 | -DAEMON=/usr/local/bin/supervisord # Python package index (pypi) version (3.0b1) | |
27 | -NAME=supervisord | |
28 | -DESC="supervisord" | |
29 | - | |
30 | -CONFIGFILE=/etc/supervisord.conf # the supervisord config file | |
31 | -SUPERVISORCTL=/usr/local/bin/supervisorctl # used for reload command(s) | |
32 | -#SUPERVISORCTL=/usr/bin/supervisorctl # again: official deb version | |
33 | - | |
34 | -if [ ! -x $DAEMON ]; then | |
35 | - echo "ERROR: Not executable: $DAEMON" | |
36 | - exit 0 | |
37 | -fi | |
38 | - | |
39 | -LOGDIR=/var/log/supervisor | |
40 | -PIDFILE=/var/run/$NAME.pid | |
41 | -DODTIME=5 # Time to wait for the server to die, in seconds | |
42 | - # If this value is set too low you might not | |
43 | - # let some servers to die gracefully and | |
44 | - # 'restart' will not work. | |
45 | - | |
46 | -# fix some args for certain commands | |
47 | -DAEMON_ARGS="-c$CONFIGFILE" | |
48 | -CTL_ARGS="-c$CONFIGFILE" | |
49 | -STARTSTOP_ARGS="--quiet --pidfile $PIDFILE --exec $DAEMON" | |
50 | - | |
51 | -# Include supervisor defaults if available | |
52 | -if [ -r /etc/default/supervisor ]; then | |
53 | - . /etc/default/supervisor | |
54 | -fi | |
55 | - | |
56 | -set -e | |
57 | - | |
58 | -dod_sleep () { | |
59 | - if [ -n "$DODTIME" ]; then | |
60 | - sleep "$DODTIME"s | |
61 | - fi | |
62 | -} | |
63 | - | |
64 | -running_pid () { | |
65 | - # Check if a pid's cmdline contains a string (name). | |
66 | - # This should work for all users. | |
67 | - pid="$1" | |
68 | - name="$2" | |
69 | - if [ -z "$pid" ]; then | |
70 | - return 1 # no pid given | |
71 | - fi | |
72 | - if [ ! -d /proc/"$pid" ]; then | |
73 | - return 1 # no /proc/$pid directory | |
74 | - fi | |
75 | - if cat /proc/"$pid"/cmdline | tr "\000" "\n"| grep -q "$name"; then | |
76 | - return 0 | |
77 | - else | |
78 | - return 1 # $pid does not match $name | |
79 | - fi | |
80 | -} | |
81 | - | |
82 | -running () { | |
83 | - # Check if DAEMON is running by examining $PIDFILE. | |
84 | - # If this succeeds, it sets $pid (a side effect being used). | |
85 | - | |
86 | - if [ ! -f "$PIDFILE" ]; then | |
87 | - return 1 # No pidfile, probably no daemon present. | |
88 | - fi | |
89 | - # Now, obtain the pid and check it's /proc cmdline: | |
90 | - pid="$(cat $PIDFILE)" | |
91 | - if running_pid "$pid" "$DAEMON"; then | |
92 | - return 0 | |
93 | - else | |
94 | - return 1 | |
95 | - fi | |
96 | -} | |
97 | - | |
98 | -normal_start () { | |
99 | - start-stop-daemon $STARTSTOP_ARGS --start \ | |
100 | - -- "$DAEMON_ARGS" $DAEMON_OPTS | |
101 | - if [ ! -f "$PIDFILE" ]; then | |
102 | - sleep 1 # grace time to create PIDFILE | |
103 | - fi | |
104 | -} | |
105 | - | |
106 | -normal_stop () { | |
107 | - #start-stop-daemon $STARTSTOP_ARGS --stop --oknodo | |
108 | - "$SUPERVISORCTL" $CTL_ARGS shutdown | |
109 | -} | |
110 | - | |
111 | -force_stop () { | |
112 | - # Forcefully stop a running DAEMON. | |
113 | - if running; then | |
114 | - kill -15 "$pid" | |
115 | - dod_sleep | |
116 | - # Check again, try harder if needed. | |
117 | - if running; then | |
118 | - kill -9 "$pid" | |
119 | - dod_sleep | |
120 | - if running; then | |
121 | - echo "Unable to kill running $NAME process (pid=$pid)!" | |
122 | - exit 1 | |
123 | - fi | |
124 | - fi | |
125 | - fi | |
126 | - rm -f "$PIDFILE" | |
127 | - return 0 | |
128 | -} | |
129 | - | |
130 | -ctl_reload () { | |
131 | - # make supervisord reload it's config | |
132 | - if [ -x "$SUPERVISORCTL" ]; then | |
133 | - "$SUPERVISORCTL" $CTL_ARGS reload | |
134 | - else | |
135 | - return 1 | |
136 | - fi | |
137 | -} | |
138 | - | |
139 | -ctl_status () { | |
140 | - # show stati of supervised processes. | |
141 | - # do not mind if this fails. | |
142 | - "$SUPERVISORCTL" $CTL_ARGS status | |
143 | -} | |
144 | - | |
145 | -case "$1" in | |
146 | - start) | |
147 | - echo -n "Starting $DESC: " | |
148 | - normal_start | |
149 | - if running; then | |
150 | - echo "$NAME." | |
151 | - else | |
152 | - echo "ERROR." | |
153 | - fi | |
154 | - ;; | |
155 | - stop) | |
156 | - echo -n "Stopping $DESC: " | |
157 | - if normal_stop; then | |
158 | - echo "$NAME." | |
159 | - else | |
160 | - echo "ERROR." | |
161 | - fi | |
162 | - ;; | |
163 | - restart) | |
164 | - echo "Restarting $DESC..." | |
165 | - "$0" stop && "$0" start | |
166 | - ;; | |
167 | - force-stop) | |
168 | - echo -n "Forcefully stopping $DESC: " | |
169 | - force_stop | |
170 | - if running; then | |
171 | - echo "$NAME." | |
172 | - else | |
173 | - echo "ERROR." | |
174 | - fi | |
175 | - ;; | |
176 | - reload|force-reload) | |
177 | - # | |
178 | - # If the daemon can reload its config files on the fly | |
179 | - # for example by sending it SIGHUP, do it here. | |
180 | - # | |
181 | - # If the daemon responds to changes in its config file | |
182 | - # directly anyway, make this a do-nothing entry. | |
183 | - # | |
184 | - echo "Reloading $DESC: " | |
185 | - if ctl_reload; then | |
186 | - echo "$NAME." | |
187 | - else | |
188 | - echo "ERROR." | |
189 | - fi | |
190 | - ;; | |
191 | - #force-reload) | |
192 | - # | |
193 | - # If the "reload" option is implemented, move the "force-reload" | |
194 | - # option to the "reload" entry above. If not, "force-reload" is | |
195 | - # just the same as "restart" except that it does nothing if the | |
196 | - # daemon isn't already running. | |
197 | - # Check wether $DAEMON is running. If so, restart. | |
198 | - #echo "Not implemented." | |
199 | - #;; | |
200 | - status) | |
201 | - echo -n "$NAME is " | |
202 | - if running; then | |
203 | - echo "running" | |
204 | -# ctl_status | |
205 | - else | |
206 | - echo "not running." | |
207 | - exit 1 | |
208 | - fi | |
209 | - ;; | |
210 | - *) | |
211 | - N=/etc/init.d/"$NAME" | |
212 | - echo "Usage: $N {start|stop|restart|reload|status|force-stop}" >&2 | |
213 | - exit 1 | |
214 | - ;; | |
215 | -esac | |
216 | - | |
217 | -exit 0 |
... | ... | @@ -0,0 +1,217 @@ |
1 | +#! /bin/sh | |
2 | +# | |
3 | +# supervisor built from skeleton /etc/init.d/ script. | |
4 | +# | |
5 | +# skeleton by Miquel van Smoorenburg <miquels@cistron.nl>. | |
6 | +# Modified for Debian by Ian Murdock <imurdock@gnu.ai.mit.edu>. | |
7 | +# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>. | |
8 | +# More changes by Konstantin Martini <isnok@tuxcode.org>. | |
9 | +# | |
10 | +# Version: @(#)supervisor 0.8 25-Jun-2013 isnok@tuxcode.org | |
11 | +# | |
12 | +### BEGIN INIT INFO | |
13 | +# Provides: supervisor | |
14 | +# Required-Start: $remote_fs $network $named | |
15 | +# Required-Stop: $remote_fs $network $named | |
16 | +# Default-Start: 2 3 4 5 | |
17 | +# Default-Stop: 0 1 6 | |
18 | +# Short-Description: Start/stop supervisord | |
19 | +# Description: Start/stop supervisor daemon and its configured | |
20 | +# subprocesses. | |
21 | +### END INIT INFO | |
22 | + | |
23 | + | |
24 | +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
25 | +#DAEMON=/usr/bin/supervisord # Debian package version (presently 3.0a8-1) | |
26 | +DAEMON=/usr/local/bin/supervisord # Python package index (pypi) version (3.0b1) | |
27 | +NAME=supervisord | |
28 | +DESC="supervisord" | |
29 | + | |
30 | +CONFIGFILE=/etc/supervisord.conf # the supervisord config file | |
31 | +SUPERVISORCTL=/usr/local/bin/supervisorctl # used for reload command(s) | |
32 | +#SUPERVISORCTL=/usr/bin/supervisorctl # again: official deb version | |
33 | + | |
34 | +if [ ! -x $DAEMON ]; then | |
35 | + echo "ERROR: Not executable: $DAEMON" | |
36 | + exit 0 | |
37 | +fi | |
38 | + | |
39 | +LOGDIR=/var/log/supervisor | |
40 | +PIDFILE=/var/run/$NAME.pid | |
41 | +DODTIME=5 # Time to wait for the server to die, in seconds | |
42 | + # If this value is set too low you might not | |
43 | + # let some servers to die gracefully and | |
44 | + # 'restart' will not work. | |
45 | + | |
46 | +# fix some args for certain commands | |
47 | +DAEMON_ARGS="-c$CONFIGFILE" | |
48 | +CTL_ARGS="-c$CONFIGFILE" | |
49 | +STARTSTOP_ARGS="--quiet --pidfile $PIDFILE --exec $DAEMON" | |
50 | + | |
51 | +# Include supervisor defaults if available | |
52 | +if [ -r /etc/default/supervisor ]; then | |
53 | + . /etc/default/supervisor | |
54 | +fi | |
55 | + | |
56 | +set -e | |
57 | + | |
58 | +dod_sleep () { | |
59 | + if [ -n "$DODTIME" ]; then | |
60 | + sleep "$DODTIME"s | |
61 | + fi | |
62 | +} | |
63 | + | |
64 | +running_pid () { | |
65 | + # Check if a pid's cmdline contains a string (name). | |
66 | + # This should work for all users. | |
67 | + pid="$1" | |
68 | + name="$2" | |
69 | + if [ -z "$pid" ]; then | |
70 | + return 1 # no pid given | |
71 | + fi | |
72 | + if [ ! -d /proc/"$pid" ]; then | |
73 | + return 1 # no /proc/$pid directory | |
74 | + fi | |
75 | + if cat /proc/"$pid"/cmdline | tr "\000" "\n"| grep -q "$name"; then | |
76 | + return 0 | |
77 | + else | |
78 | + return 1 # $pid does not match $name | |
79 | + fi | |
80 | +} | |
81 | + | |
82 | +running () { | |
83 | + # Check if DAEMON is running by examining $PIDFILE. | |
84 | + # If this succeeds, it sets $pid (a side effect being used). | |
85 | + | |
86 | + if [ ! -f "$PIDFILE" ]; then | |
87 | + return 1 # No pidfile, probably no daemon present. | |
88 | + fi | |
89 | + # Now, obtain the pid and check it's /proc cmdline: | |
90 | + pid="$(cat $PIDFILE)" | |
91 | + if running_pid "$pid" "$DAEMON"; then | |
92 | + return 0 | |
93 | + else | |
94 | + return 1 | |
95 | + fi | |
96 | +} | |
97 | + | |
98 | +normal_start () { | |
99 | + start-stop-daemon $STARTSTOP_ARGS --start \ | |
100 | + -- "$DAEMON_ARGS" $DAEMON_OPTS | |
101 | + if [ ! -f "$PIDFILE" ]; then | |
102 | + sleep 1 # grace time to create PIDFILE | |
103 | + fi | |
104 | +} | |
105 | + | |
106 | +normal_stop () { | |
107 | + #start-stop-daemon $STARTSTOP_ARGS --stop --oknodo | |
108 | + "$SUPERVISORCTL" $CTL_ARGS shutdown | |
109 | +} | |
110 | + | |
111 | +force_stop () { | |
112 | + # Forcefully stop a running DAEMON. | |
113 | + if running; then | |
114 | + kill -15 "$pid" | |
115 | + dod_sleep | |
116 | + # Check again, try harder if needed. | |
117 | + if running; then | |
118 | + kill -9 "$pid" | |
119 | + dod_sleep | |
120 | + if running; then | |
121 | + echo "Unable to kill running $NAME process (pid=$pid)!" | |
122 | + exit 1 | |
123 | + fi | |
124 | + fi | |
125 | + fi | |
126 | + rm -f "$PIDFILE" | |
127 | + return 0 | |
128 | +} | |
129 | + | |
130 | +ctl_reload () { | |
131 | + # make supervisord reload it's config | |
132 | + if [ -x "$SUPERVISORCTL" ]; then | |
133 | + "$SUPERVISORCTL" $CTL_ARGS reload | |
134 | + else | |
135 | + return 1 | |
136 | + fi | |
137 | +} | |
138 | + | |
139 | +ctl_status () { | |
140 | + # show stati of supervised processes. | |
141 | + # do not mind if this fails. | |
142 | + "$SUPERVISORCTL" $CTL_ARGS status | |
143 | +} | |
144 | + | |
145 | +case "$1" in | |
146 | + start) | |
147 | + echo -n "Starting $DESC: " | |
148 | + normal_start | |
149 | + if running; then | |
150 | + echo "$NAME." | |
151 | + else | |
152 | + echo "ERROR." | |
153 | + fi | |
154 | + ;; | |
155 | + stop) | |
156 | + echo -n "Stopping $DESC: " | |
157 | + if normal_stop; then | |
158 | + echo "$NAME." | |
159 | + else | |
160 | + echo "ERROR." | |
161 | + fi | |
162 | + ;; | |
163 | + restart) | |
164 | + echo "Restarting $DESC..." | |
165 | + "$0" stop && "$0" start | |
166 | + ;; | |
167 | + force-stop) | |
168 | + echo -n "Forcefully stopping $DESC: " | |
169 | + force_stop | |
170 | + if running; then | |
171 | + echo "$NAME." | |
172 | + else | |
173 | + echo "ERROR." | |
174 | + fi | |
175 | + ;; | |
176 | + reload|force-reload) | |
177 | + # | |
178 | + # If the daemon can reload its config files on the fly | |
179 | + # for example by sending it SIGHUP, do it here. | |
180 | + # | |
181 | + # If the daemon responds to changes in its config file | |
182 | + # directly anyway, make this a do-nothing entry. | |
183 | + # | |
184 | + echo "Reloading $DESC: " | |
185 | + if ctl_reload; then | |
186 | + echo "$NAME." | |
187 | + else | |
188 | + echo "ERROR." | |
189 | + fi | |
190 | + ;; | |
191 | + #force-reload) | |
192 | + # | |
193 | + # If the "reload" option is implemented, move the "force-reload" | |
194 | + # option to the "reload" entry above. If not, "force-reload" is | |
195 | + # just the same as "restart" except that it does nothing if the | |
196 | + # daemon isn't already running. | |
197 | + # Check wether $DAEMON is running. If so, restart. | |
198 | + #echo "Not implemented." | |
199 | + #;; | |
200 | + status) | |
201 | + echo -n "$NAME is " | |
202 | + if running; then | |
203 | + echo "running" | |
204 | +# ctl_status | |
205 | + else | |
206 | + echo "not running." | |
207 | + exit 1 | |
208 | + fi | |
209 | + ;; | |
210 | + *) | |
211 | + N=/etc/init.d/"$NAME" | |
212 | + echo "Usage: $N {start|stop|restart|reload|status|force-stop}" >&2 | |
213 | + exit 1 | |
214 | + ;; | |
215 | +esac | |
216 | + | |
217 | +exit 0 | ... | ... |
... | ... | @@ -0,0 +1,170 @@ |
1 | +#! /bin/sh | |
2 | +# | |
3 | +# Downloaded from: | |
4 | +# http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/supervisor/trusty/view/head:/debian/supervisor.init | |
5 | +# | |
6 | +# skeleton example file to build /etc/init.d/ scripts. | |
7 | +# This file should be used to construct scripts for /etc/init.d. | |
8 | +# | |
9 | +# Written by Miquel van Smoorenburg <miquels@cistron.nl>. | |
10 | +# Modified for Debian | |
11 | +# by Ian Murdock <imurdock@gnu.ai.mit.edu>. | |
12 | +# Further changes by Javier Fernandez-Sanguino <jfs@debian.org> | |
13 | +# | |
14 | +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl | |
15 | +# | |
16 | +### BEGIN INIT INFO | |
17 | +# Provides: supervisor | |
18 | +# Required-Start: $remote_fs $network $named | |
19 | +# Required-Stop: $remote_fs $network $named | |
20 | +# Default-Start: 2 3 4 5 | |
21 | +# Default-Stop: 0 1 6 | |
22 | +# Short-Description: Start/stop supervisor | |
23 | +# Description: Start/stop supervisor daemon and its configured | |
24 | +# subprocesses. | |
25 | +### END INIT INFO | |
26 | + | |
27 | +. /lib/lsb/init-functions | |
28 | + | |
29 | +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
30 | +DAEMON=/usr/local/bin/supervisord | |
31 | +NAME=supervisord | |
32 | +DESC=supervisor | |
33 | + | |
34 | +test -x $DAEMON || exit 0 | |
35 | + | |
36 | +LOGDIR=/var/log/supervisor | |
37 | +PIDFILE=/var/run/$NAME.pid | |
38 | +DODTIME=5 # Time to wait for the server to die, in seconds | |
39 | + # If this value is set too low you might not | |
40 | + # let some servers to die gracefully and | |
41 | + # 'restart' will not work | |
42 | + | |
43 | +# Include supervisor defaults if available | |
44 | +if [ -f /etc/default/supervisor ] ; then | |
45 | + . /etc/default/supervisor | |
46 | +fi | |
47 | +DAEMON_OPTS="-c /etc/supervisord.conf $DAEMON_OPTS" | |
48 | + | |
49 | +set -e | |
50 | + | |
51 | +running_pid() | |
52 | +{ | |
53 | + # Check if a given process pid's cmdline matches a given name | |
54 | + pid=$1 | |
55 | + name=$2 | |
56 | + [ -z "$pid" ] && return 1 | |
57 | + [ ! -d /proc/$pid ] && return 1 | |
58 | + (cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1 | |
59 | + return 0 | |
60 | +} | |
61 | + | |
62 | +running() | |
63 | +{ | |
64 | +# Check if the process is running looking at /proc | |
65 | +# (works for all users) | |
66 | + | |
67 | + # No pidfile, probably no daemon present | |
68 | + [ ! -f "$PIDFILE" ] && return 1 | |
69 | + # Obtain the pid and check it against the binary name | |
70 | + pid=`cat $PIDFILE` | |
71 | + running_pid $pid $DAEMON || return 1 | |
72 | + return 0 | |
73 | +} | |
74 | + | |
75 | +force_stop() { | |
76 | +# Forcefully kill the process | |
77 | + [ ! -f "$PIDFILE" ] && return | |
78 | + if running ; then | |
79 | + kill -15 $pid | |
80 | + # Is it really dead? | |
81 | + [ -n "$DODTIME" ] && sleep "$DODTIME"s | |
82 | + if running ; then | |
83 | + kill -9 $pid | |
84 | + [ -n "$DODTIME" ] && sleep "$DODTIME"s | |
85 | + if running ; then | |
86 | + echo "Cannot kill $LABEL (pid=$pid)!" | |
87 | + exit 1 | |
88 | + fi | |
89 | + fi | |
90 | + fi | |
91 | + rm -f $PIDFILE | |
92 | + return 0 | |
93 | +} | |
94 | + | |
95 | +case "$1" in | |
96 | + start) | |
97 | + echo -n "Starting $DESC: " | |
98 | + start-stop-daemon --start --quiet --pidfile $PIDFILE \ | |
99 | + --startas $DAEMON -- $DAEMON_OPTS | |
100 | + test -f $PIDFILE || sleep 1 | |
101 | + if running ; then | |
102 | + echo "$NAME." | |
103 | + else | |
104 | + echo " ERROR." | |
105 | + fi | |
106 | + ;; | |
107 | + stop) | |
108 | + echo -n "Stopping $DESC: " | |
109 | + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | |
110 | + echo "$NAME." | |
111 | + ;; | |
112 | + force-stop) | |
113 | + echo -n "Forcefully stopping $DESC: " | |
114 | + force_stop | |
115 | + if ! running ; then | |
116 | + echo "$NAME." | |
117 | + else | |
118 | + echo " ERROR." | |
119 | + fi | |
120 | + ;; | |
121 | + #reload) | |
122 | + # | |
123 | + # If the daemon can reload its config files on the fly | |
124 | + # for example by sending it SIGHUP, do it here. | |
125 | + # | |
126 | + # If the daemon responds to changes in its config file | |
127 | + # directly anyway, make this a do-nothing entry. | |
128 | + # | |
129 | + # echo "Reloading $DESC configuration files." | |
130 | + # start-stop-daemon --stop --signal 1 --quiet --pidfile \ | |
131 | + # /var/run/$NAME.pid --exec $DAEMON | |
132 | + #;; | |
133 | + force-reload) | |
134 | + # | |
135 | + # If the "reload" option is implemented, move the "force-reload" | |
136 | + # option to the "reload" entry above. If not, "force-reload" is | |
137 | + # just the same as "restart" except that it does nothing if the | |
138 | + # daemon isn't already running. | |
139 | + # check wether $DAEMON is running. If so, restart | |
140 | + start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \ | |
141 | + --startas $DAEMON \ | |
142 | + && $0 restart \ | |
143 | + || exit 0 | |
144 | + ;; | |
145 | + restart) | |
146 | + echo -n "Restarting $DESC: " | |
147 | + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | |
148 | + [ -n "$DODTIME" ] && sleep $DODTIME | |
149 | + start-stop-daemon --start --quiet --pidfile $PIDFILE \ | |
150 | + --startas $DAEMON -- $DAEMON_OPTS | |
151 | + echo "$NAME." | |
152 | + ;; | |
153 | + status) | |
154 | + echo -n "$LABEL is " | |
155 | + if running ; then | |
156 | + echo "running" | |
157 | + else | |
158 | + echo " not running." | |
159 | + exit 1 | |
160 | + fi | |
161 | + ;; | |
162 | + *) | |
163 | + N=/etc/init.d/$NAME | |
164 | + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 | |
165 | + echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2 | |
166 | + exit 1 | |
167 | + ;; | |
168 | +esac | |
169 | + | |
170 | +exit 0 | ... | ... |
puppet/modules/supervisor/manifests/app.pp
puppet/modules/supervisor/manifests/init.pp
... | ... | @@ -16,8 +16,13 @@ class supervisor { |
16 | 16 | subscribe => File['/etc/supervisord.conf'], |
17 | 17 | } |
18 | 18 | |
19 | + case $operatingsystem { | |
20 | + debian: { $supervisord_conf = "puppet:///modules/supervisor/debian-isnok-initscript" } | |
21 | + ubuntu: { $supervisord_conf = "puppet:///modules/supervisor/ubuntu-initscript" } | |
22 | + } | |
23 | + | |
19 | 24 | file { '/etc/init.d/supervisord': |
20 | - source => 'puppet:///modules/supervisor/debian-isnok', | |
25 | + source => $supervisord_conf, | |
21 | 26 | mode => '0755', |
22 | 27 | } |
23 | 28 | ... | ... |
puppet/modules/supervisor/templates/supervisor.conf.erb
... | ... | @@ -5,3 +5,12 @@ user=<%= @user %> |
5 | 5 | autostart=true |
6 | 6 | autorestart=true |
7 | 7 | redirect_stderr=True |
8 | +<%- if @startsecs -%> | |
9 | +startsecs=<%= @startsecs %> | |
10 | +<%- end -%> | |
11 | +<%- if @stopwaitsecs -%> | |
12 | +stopwaitsecs=<%= @stopwaitsecs %> | |
13 | +<%- end -%> | |
14 | +<%- if @priority -%> | |
15 | +priority=<%= @priority %> | |
16 | +<%- end -%> | ... | ... |