You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gw...@apache.org on 2016/03/04 02:41:52 UTC
kafka git commit: KAFKA-3281: Improve message of *-server-stop.sh
when process is not running
Repository: kafka
Updated Branches:
refs/heads/trunk d63bdc28c -> f7887bd6f
KAFKA-3281: Improve message of *-server-stop.sh when process is not running
Stop scritps such as kafka-server-stop.sh log messages of kill command's error when processes aren't running.
This PR changes this message to "No kafka server to stop".
Author: Sasaki Toru <sa...@nttdata.co.jp>
Reviewers: Gwen Shapira
Closes #971 from sasakitoa/stop_scripts_says_not_good_message
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/f7887bd6
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/f7887bd6
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/f7887bd6
Branch: refs/heads/trunk
Commit: f7887bd6f9db578a5a3ee04606bb4f3a74528eb8
Parents: d63bdc2
Author: Sasaki Toru <sa...@nttdata.co.jp>
Authored: Thu Mar 3 17:41:47 2016 -0800
Committer: Gwen Shapira <cs...@gmail.com>
Committed: Thu Mar 3 17:41:47 2016 -0800
----------------------------------------------------------------------
bin/kafka-server-stop.sh | 10 +++++++++-
bin/zookeeper-server-stop.sh | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/f7887bd6/bin/kafka-server-stop.sh
----------------------------------------------------------------------
diff --git a/bin/kafka-server-stop.sh b/bin/kafka-server-stop.sh
index cd8160c..f75ded7 100755
--- a/bin/kafka-server-stop.sh
+++ b/bin/kafka-server-stop.sh
@@ -13,4 +13,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}' | xargs kill -SIGTERM
+PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}')
+
+if [ -z "$PIDS" ]; then
+ echo "No kafka server to stop"
+ exit 1
+else
+ kill -SIGTERM $PIDS
+fi
+
http://git-wip-us.apache.org/repos/asf/kafka/blob/f7887bd6/bin/zookeeper-server-stop.sh
----------------------------------------------------------------------
diff --git a/bin/zookeeper-server-stop.sh b/bin/zookeeper-server-stop.sh
index 409176f..07c7910 100755
--- a/bin/zookeeper-server-stop.sh
+++ b/bin/zookeeper-server-stop.sh
@@ -13,4 +13,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}' | xargs kill -SIGTERM
+PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}')
+
+if [ -z "$PIDS" ]; then
+ echo "No zookeeper server to stop"
+ exit 1
+else
+ kill -SIGTERM $PIDS
+fi
+