From eca8f82adf0bb391b2e2879fb33b905099f93b3b Mon Sep 17 00:00:00 2001 From: "Cheyenne T. Greatorex" Date: Thu, 21 Apr 2016 16:00:42 -0400 Subject: [PATCH] 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 --- pkg/logstash.default | 2 +- pkg/logstash.sysv | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/logstash.default b/pkg/logstash.default index 6203bc72f..a1874d050 100644 --- a/pkg/logstash.default +++ b/pkg/logstash.default @@ -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 diff --git a/pkg/logstash.sysv b/pkg/logstash.sysv index 16ef56612..944d810c2 100755 --- a/pkg/logstash.sysv +++ b/pkg/logstash.sysv @@ -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."