未验证 提交 7a6edb7c 编写于 作者: Y yuz10 提交者: GitHub

[ISSUE #2926] fix fast-try.sh fail to run in ubuntu (#2927)

* #2926 fix fast-try.sh fail to run in ubuntu

* update fast-try.sh
上级 952772fa
#!/bin/sh #!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
...@@ -20,25 +20,25 @@ CURRENT_DIR="$(cd "$(dirname "$0")"; pwd)" ...@@ -20,25 +20,25 @@ CURRENT_DIR="$(cd "$(dirname "$0")"; pwd)"
RMQ_DIR=$CURRENT_DIR/../.. RMQ_DIR=$CURRENT_DIR/../..
cd $RMQ_DIR cd $RMQ_DIR
function startNameserver() { startNameserver() {
export JAVA_OPT_EXT=" -Xms512m -Xmx512m " export JAVA_OPT_EXT=" -Xms512m -Xmx512m "
nohup bin/mqnamesrv & nohup bin/mqnamesrv &
} }
function startBroker() { startBroker() {
export JAVA_OPT_EXT=" -Xms1g -Xmx1g " export JAVA_OPT_EXT=" -Xms1g -Xmx1g "
conf_name=$1 conf_name=$1
nohup bin/mqbroker -c $conf_name & nohup bin/mqbroker -c $conf_name &
} }
function stopNameserver() { stopNameserver() {
PIDS=$(ps -ef|grep java|grep NamesrvStartup|grep -v grep|awk '{print $2}') PIDS=$(ps -ef|grep java|grep NamesrvStartup|grep -v grep|awk '{print $2}')
if [ ! -z "$PIDS" ]; then if [ ! -z "$PIDS" ]; then
kill -s TERM $PIDS kill -s TERM $PIDS
fi fi
} }
function stopBroker() { stopBroker() {
conf_name=$1 conf_name=$1
PIDS=$(ps -ef|grep java|grep BrokerStartup|grep $conf_name|grep -v grep|awk '{print $2}') PIDS=$(ps -ef|grep java|grep BrokerStartup|grep $conf_name|grep -v grep|awk '{print $2}')
i=1 i=1
...@@ -46,7 +46,7 @@ function stopBroker() { ...@@ -46,7 +46,7 @@ function stopBroker() {
do do
echo "Waiting to kill ..." echo "Waiting to kill ..."
kill -s TERM $PIDS kill -s TERM $PIDS
((i=$i+1)) i=`expr $i + 1`
sleep 2 sleep 2
PIDS=$(ps -ef|grep java|grep BrokerStartup|grep $conf_name|grep -v grep|awk '{print $2}') PIDS=$(ps -ef|grep java|grep BrokerStartup|grep $conf_name|grep -v grep|awk '{print $2}')
done done
...@@ -56,7 +56,7 @@ function stopBroker() { ...@@ -56,7 +56,7 @@ function stopBroker() {
fi fi
} }
function stopAll() { stopAll() {
ps -ef|grep java|grep BrokerStartup|grep -v grep|awk '{print $2}'|xargs kill ps -ef|grep java|grep BrokerStartup|grep -v grep|awk '{print $2}'|xargs kill
stopNameserver stopNameserver
stopBroker ./conf/dledger/broker-n0.conf stopBroker ./conf/dledger/broker-n0.conf
...@@ -64,17 +64,17 @@ function stopAll() { ...@@ -64,17 +64,17 @@ function stopAll() {
stopBroker ./conf/dledger/broker-n2.conf stopBroker ./conf/dledger/broker-n2.conf
} }
function startAll() { startAll() {
startNameserver startNameserver
startBroker ./conf/dledger/broker-n0.conf startBroker ./conf/dledger/broker-n0.conf
startBroker ./conf/dledger/broker-n1.conf startBroker ./conf/dledger/broker-n1.conf
startBroker ./conf/dledger/broker-n2.conf startBroker ./conf/dledger/broker-n2.conf
} }
function checkConf() { checkConf() {
if [ ! -f ./conf/dledger/broker-n0.conf -o ! -f ./conf/dledger/broker-n1.conf -o ! -f ./conf/dledger/broker-n2.conf ]; then if [ ! -f ./conf/dledger/broker-n0.conf -o ! -f ./conf/dledger/broker-n1.conf -o ! -f ./conf/dledger/broker-n2.conf ]; then
echo "Make sure the ./conf/dledger/broker-n0.conf, ./conf/dledger/broker-n1.conf, ./conf/dledger/broker-n2.conf exists" echo "Make sure the ./conf/dledger/broker-n0.conf, ./conf/dledger/broker-n1.conf, ./conf/dledger/broker-n2.conf exists"
exit -1 exit 1
fi fi
} }
...@@ -83,7 +83,7 @@ function checkConf() { ...@@ -83,7 +83,7 @@ function checkConf() {
## Main ## Main
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo "Usage: sh $0 start|stop" echo "Usage: sh $0 start|stop"
exit -1 exit 1
fi fi
action=$1 action=$1
checkConf checkConf
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册