mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Fixed force kill variable name, added a default setting for it, and added code to the stop function to handle inability to stop when not forcing
Fixes #4991, #5168
This commit is contained in:
parent
2a7b5668ca
commit
eca8f82adf
2 changed files with 4 additions and 2 deletions
|
@ -38,4 +38,4 @@
|
|||
# If this is set to 1, then when `stop` is called, if the process has
|
||||
# not exited within a reasonable time, SIGKILL will be sent next.
|
||||
# The default behavior is to simply log a message "program stop failed; still running"
|
||||
KILL_ON_STOP_TIMEOUT=0
|
||||
#KILL_ON_STOP_TIMEOUT=0
|
||||
|
|
|
@ -35,6 +35,7 @@ LS_LOG_FILE="${LS_LOG_DIR}/$name.log"
|
|||
LS_CONF_DIR=/etc/logstash/conf.d
|
||||
LS_OPEN_FILES=16384
|
||||
LS_NICE=19
|
||||
KILL_ON_STOP_TIMEOUT=0
|
||||
LS_OPTS=""
|
||||
|
||||
|
||||
|
@ -96,12 +97,13 @@ stop() {
|
|||
sleep 1
|
||||
done
|
||||
if status ; then
|
||||
if [ $KILL_ON_STOP_TIMEOUT -eq 1 ] ; then
|
||||
if [ "$KILL_ON_STOP_TIMEOUT" == 1 ] ; then
|
||||
echo "Timeout reached. Killing $name (pid $pid) with SIGKILL. This may result in data loss."
|
||||
kill -KILL $pid
|
||||
echo "$name killed with SIGKILL."
|
||||
else
|
||||
echo "$name stop failed; still running."
|
||||
return 1 # stop timed out and not forced
|
||||
fi
|
||||
else
|
||||
echo "$name stopped."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue