This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch TUBEMQ-336
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git


The following commit(s) were added to refs/heads/TUBEMQ-336 by this push:
     new fb84d67  [TUBEMQ-412] tube manager start stop scrrpts (#317)
fb84d67 is described below

commit fb84d678f8dbad2951e01b43f0b4262260d2f506
Author: Yuanbo Liu <[email protected]>
AuthorDate: Wed Nov 18 19:53:42 2020 +0800

    [TUBEMQ-412] tube manager start stop scrrpts (#317)
    
    * [TUBEMQ-412] tube manager start stop scrrpts
---
 tubemq-manager/bin/start-manager.sh | 60 +++++++++++++++++++++++++++++++++++++
 tubemq-manager/bin/stop-manager.sh  | 31 +++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git a/tubemq-manager/bin/start-manager.sh 
b/tubemq-manager/bin/start-manager.sh
new file mode 100755
index 0000000..19acbef
--- /dev/null
+++ b/tubemq-manager/bin/start-manager.sh
@@ -0,0 +1,60 @@
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions an
+# limitations under the License.
+
+base_dir=$(dirname $0)
+
+DAEMON_NAME=${DAEMON_NAME:-"tubemq-manager"}
+LOG_DIR=${LOG_DIR:-"$base_dir/../logs"}
+CONF_DIR=${CONF_DIR:-"$base_dir/../conf"}
+LIB_DIR=${LIB_DIR:-"$base_dir/../lib"}
+CONSOLE_OUTPUT_FILE=$LOG_DIR/$DAEMON_NAME.out
+MANAGER_HEAP_OPTS="-Xmx16G -Xms16G"
+MANAGER_GC_OPTS="-XX:+UseG1GC -verbose:gc -verbose:sizes 
-Xloggc:${LOG_DIR}/gc.log.`date +%Y-%m-%d-%H-%M-%S` -XX:+PrintGCDetails 
-XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution"
+
+# create logs directory
+if [ ! -d "$LOG_DIR" ]; then
+  mkdir -p "$LOG_DIR"
+fi
+
+# Exclude jars not necessary for running commands.
+regex="(-(test|test-sources|src|scaladoc|javadoc)\.jar|jar.asc)$"
+should_include_file() {
+  if [ "$INCLUDE_TEST_JARS" = true ]; then
+    return 0
+  fi
+  file=$1
+  if [ -z "$(echo "$file" | egrep "$regex")" ] ; then
+    return 0
+  else
+    return 1
+  fi
+}
+
+for file in ${LIB_DIR}/*.jar;
+do
+  if should_include_file "$file"; then
+    CLASSPATH="$CLASSPATH":"$file"
+  fi
+done
+
+CLASSPATH="${CONF_DIR}":$CLASSPATH
+export MANAGER_JVM_OPTS="${MANAGER_HEAP_OPTS} ${MANAGER_GC_OPTS} 
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_DIR}"
+
+# Which java to use
+if [ -z "$JAVA_HOME" ]; then
+  JAVA="java"
+else
+  JAVA="$JAVA_HOME/bin/java"
+fi
+
+nohup "$JAVA" $MANAGER_JVM_OPTS -cp "$CLASSPATH" 
org.apache.tubemq.manager.TubeMQManager "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1 < 
/dev/null &
diff --git a/tubemq-manager/bin/stop-manager.sh 
b/tubemq-manager/bin/stop-manager.sh
new file mode 100755
index 0000000..a3b7abd
--- /dev/null
+++ b/tubemq-manager/bin/stop-manager.sh
@@ -0,0 +1,31 @@
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions an
+# limitations under the License.
+
+SIGNAL=${SIGNAL:-TERM}
+
+if [[ $(uname -s) == "OS/390" ]]; then
+    if [ -z $JOBNAME ]; then
+        JOBNAME="TubeMQManager"
+    fi
+    PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v 
grep | awk '{print $1}')
+else
+    PIDS=$(jcmd  | grep -i 'TubeMQManager'  | awk '{print $1}')
+fi
+
+if [ -z "$PIDS" ]; then
+  echo "No tubemq manager server to stop"
+  exit 1
+else
+  kill -s $SIGNAL $PIDS
+  echo "stop tubemq manager .... $PIDS"
+fi

Reply via email to