Lines 237-243
Link Here
|
237 |
|
237 |
|
238 |
stop_daemon() |
238 |
stop_daemon() |
239 |
{ |
239 |
{ |
240 |
local ANNOUNCE BASENAME CMDNAME DEFAULT DISPNAME EXPECT FLAGS HUPSIG LOCKFILE MESSAGE NAME PIDFILE SIGNAL STATUS WHICH |
240 |
local ANNOUNCE BASENAME CMDNAME DEFAULT DISPNAME EXPECT FLAGS HUPSIG LOCKFILE MESSAGE NAME PIDFILE SIGNAL STATUS WHICH TIMEOUT |
241 |
|
241 |
|
242 |
# Process options. |
242 |
# Process options. |
243 |
ANNOUNCE=1 |
243 |
ANNOUNCE=1 |
Lines 248-253
Link Here
|
248 |
LOCKFILE= |
248 |
LOCKFILE= |
249 |
NAME= |
249 |
NAME= |
250 |
PIDFILE= |
250 |
PIDFILE= |
|
|
251 |
TIMEOUT=1 |
251 |
# start-stop-daemon wants a signal number. |
252 |
# start-stop-daemon wants a signal number. |
252 |
SIGNAL="$(kill -l TERM)" || SIGNAL=15 |
253 |
SIGNAL="$(kill -l TERM)" || SIGNAL=15 |
253 |
HUPSIG="$(kill -l HUP)" || HUPSIG=1 |
254 |
HUPSIG="$(kill -l HUP)" || HUPSIG=1 |
Lines 292-297
Link Here
|
292 |
PIDFILE="$1" |
293 |
PIDFILE="$1" |
293 |
shift |
294 |
shift |
294 |
;; |
295 |
;; |
|
|
296 |
--timeout) |
297 |
shift |
298 |
TIMEOUT="$1" |
299 |
shift |
300 |
;; |
295 |
-[0-9]*) |
301 |
-[0-9]*) |
296 |
SIGNAL="${1##-}" |
302 |
SIGNAL="${1##-}" |
297 |
DEFAULT=false |
303 |
DEFAULT=false |
Lines 372-382
Link Here
|
372 |
# custom signal. |
378 |
# custom signal. |
373 |
if [ "$DEFAULT" = true -a $STATUS -eq 0 ]; then |
379 |
if [ "$DEFAULT" = true -a $STATUS -eq 0 ]; then |
374 |
usleep 100000 |
380 |
usleep 100000 |
375 |
if start-stop-daemon $FLAGS --test > /dev/null; then |
381 |
for ((i=1; i <= TIMEOUT ; i++)) |
376 |
sleep 1 |
382 |
do |
377 |
SIGNAL="$(kill -l KILL)" || SIGNAL=9 |
383 |
if start-stop-daemon $FLAGS --test > /dev/null; then |
378 |
start-stop-daemon $FLAGS --signal "$SIGNAL" > /dev/null |
384 |
sleep 1 |
379 |
fi |
385 |
if [ $i == $TIMEOUT ]; then |
|
|
386 |
SIGNAL="$(kill -l KILL)" || SIGNAL=9 |
387 |
start-stop-daemon $FLAGS --signal "$SIGNAL" > /dev/null |
388 |
fi |
389 |
else |
390 |
break |
391 |
fi |
392 |
|
393 |
done |
380 |
[ -z "$PIDFILE" ] || rm -f "$PIDFILE" |
394 |
[ -z "$PIDFILE" ] || rm -f "$PIDFILE" |
381 |
fi |
395 |
fi |
382 |
|
396 |
|