You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ic...@apache.org on 2023/01/03 09:03:58 UTC

[incubator-seatunnel] branch dev updated: [Feature][Engine] Add support close engine instance shell. (#3776)

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

ic4y pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 234638afb [Feature][Engine] Add support close engine instance shell. (#3776)
234638afb is described below

commit 234638afbead777ff5ef2ec7f45172a67fce1ecb
Author: FWLamb <54...@qq.com>
AuthorDate: Tue Jan 3 17:03:53 2023 +0800

    [Feature][Engine] Add support close engine instance shell. (#3776)
    
    * Add support close engine instance shell
---
 .../src/main/bin/stop-seatunnel-cluster.sh         | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/seatunnel-core/seatunnel-starter/src/main/bin/stop-seatunnel-cluster.sh b/seatunnel-core/seatunnel-starter/src/main/bin/stop-seatunnel-cluster.sh
new file mode 100644
index 000000000..dcdc4f982
--- /dev/null
+++ b/seatunnel-core/seatunnel-starter/src/main/bin/stop-seatunnel-cluster.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# 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 and
+# limitations under the License.
+#
+
+SEATUNNEL_DEFAULT_CLUSTER_NAME="seatunnel_default_cluster"
+SHOW_USAGE="Usage: stop-seatunnel-cluster.sh [options]\n Options:\n       -cn, --cluster      The name of the cluster
+ to shut down (default: $SEATUNNEL_DEFAULT_CLUSTER_NAME)\n        -h, --help          Show the usage message"
+APP_MAIN="org.apache.seatunnel.core.starter.seatunnel.SeaTunnelServer"
+
+
+if [ $# -ne 0 ]; then
+  while true; do
+    case "$1" in
+      -cn|--cluster)
+        shift
+        CLUSTER_NAME="$1"
+        break
+        ;;
+      -h|--help)
+        echo -e $SHOW_USAGE
+        exit 0
+        ;;
+      *)
+        echo "Unknown option: $1, please use [-h | --help] to show options"
+        exit 0
+        ;;
+    esac
+  done
+fi
+
+if test -z $CLUSTER_NAME;then
+   RES=$(ps -ef | grep $APP_MAIN | grep -v "\-cn\|\--cluster" | grep -v grep | awk '{print $2}')
+   if test -z $RES;then
+     echo "$SEATUNNEL_DEFAULT_CLUSTER_NAME is not running. Please check the correct name of the running cluster."
+     exit 0
+   fi
+   kill $RES >/dev/null
+else
+   RES=$(ps -ef | grep $APP_MAIN | grep $CLUSTER_NAME | grep -v grep | awk '{print $2}')
+   if test -z $RES;then
+     echo "$CLUSTER_NAME is not running. Please check the correct name of the running cluster."
+     exit 0
+   fi
+   kill $RES >/dev/null
+fi
\ No newline at end of file