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

gavinchou pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 92b0a1319e3 [chore](bash) Support  meta-service `./start.sh --version` 
(#38667)
92b0a1319e3 is described below

commit 92b0a1319e3996f69ef8ebab00d505bd74b92a34
Author: yagagagaga <zhangminkefromflyd...@gmail.com>
AuthorDate: Thu Aug 8 15:01:31 2024 +0800

    [chore](bash) Support  meta-service `./start.sh --version` (#38667)
    
    Before:
    
    ```bash
    root@d9bbde2b1627:~/re# bash bin/start.sh --version
    LIBHDFS3_CONF=
    starts doris_cloud with args:
    args: {conf=./conf/doris_cloud.conf; path to conf file}, {help=false; print 
help msg}, {meta-service=false; run as meta-service}, {recycler=false; run as 
recycler}, {version=false; print version info},
    ```
    
    After:
    
    ```bash
    root@d9bbde2b1627:~/re# bash bin/start.sh --version
    LIBHDFS3_CONF=
    version:{doris-3.0.0-rc11-release} 
code_version:{commit=2d7acd01beab07e8b9720d7cb7e40e205de4c927 time=2024-07-16 
13:37:56 +0800} build_info:{initiator=root@iZ2ze9pz2eap5besutxc7oZ 
build_at=2024-07-16 13:37:56 +0800 build_on=PRETTY_NAME="Ubuntu 22.04.4 LTS" 
NAME="Ubuntu" }
    
    ```
---
 bin/start_be.sh       |  2 +-
 cloud/script/start.sh | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/bin/start_be.sh b/bin/start_be.sh
index cb51d8f381a..01af80de0cb 100755
--- a/bin/start_be.sh
+++ b/bin/start_be.sh
@@ -172,7 +172,7 @@ setup_java_env || true
 if [[ "${RUN_VERSION}" -eq 1 ]]; then
     chmod 755 "${DORIS_HOME}/lib/doris_be"
     "${DORIS_HOME}"/lib/doris_be --version
-    exit 1
+    exit 0
 fi
 
 if [[ "$(uname -s)" != 'Darwin' ]]; then
diff --git a/cloud/script/start.sh b/cloud/script/start.sh
index 94638957a86..ebe2f88e16c 100644
--- a/cloud/script/start.sh
+++ b/cloud/script/start.sh
@@ -16,6 +16,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+set -eo pipefail
+
 curdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
 
 DORIS_HOME="$(
@@ -30,12 +32,14 @@ if [[ ! -d bin || ! -d conf || ! -d lib ]]; then
     exit 1
 fi
 
-daemonized=0
+RUN_DAEMON=0
+RUN_VERSION=0
 for arg; do
     shift
-    [[ "${arg}" = "--daemonized" ]] && daemonized=1 && continue
-    [[ "${arg}" = "-daemonized" ]] && daemonized=1 && continue
-    [[ "${arg}" = "--daemon" ]] && daemonized=1 && continue
+    [[ "${arg}" = "--daemonized" ]] && RUN_DAEMON=1 && continue
+    [[ "${arg}" = "-daemonized" ]] && RUN_DAEMON=1 && continue
+    [[ "${arg}" = "--daemon" ]] && RUN_DAEMON=1 && continue
+    [[ "${arg}" = "--version" ]] && RUN_VERSION=1 && continue
     set -- "$@" "${arg}"
 done
 # echo "$@" "daemonized=${daemonized}"}
@@ -118,9 +122,14 @@ echo "LIBHDFS3_CONF=${LIBHDFS3_CONF}"
 
 export 
JEMALLOC_CONF="percpu_arena:percpu,background_thread:true,metadata_thp:auto,muzzy_decay_ms:15000,dirty_decay_ms:15000,oversize_threshold:0,prof:true,prof_prefix:jeprof.out"
 
+if [[ "${RUN_VERSION}" -eq 1 ]]; then
+    "${bin}" --version
+    exit 0
+fi
+
 mkdir -p "${DORIS_HOME}/log"
 echo "starts ${process} with args: $*"
-if [[ "${daemonized}" -eq 1 ]]; then
+if [[ "${RUN_DAEMON}" -eq 1 ]]; then
     date >>"${DORIS_HOME}/log/${process}.out"
     nohup "${bin}" "$@" >>"${DORIS_HOME}/log/${process}.out" 2>&1 &
     # wait for log flush


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to