From b3bff4c76a49e523a5ee940744b4c1a0d9d2e431 Mon Sep 17 00:00:00 2001 From: coderzc Date: Sun, 20 Nov 2022 21:38:07 +0800 Subject: [PATCH 1/4] Fix start shell --- hugegraph-dist/src/assembly/static/bin/hugegraph | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph b/hugegraph-dist/src/assembly/static/bin/hugegraph index cc566c3063..f75da2c04e 100644 --- a/hugegraph-dist/src/assembly/static/bin/hugegraph +++ b/hugegraph-dist/src/assembly/static/bin/hugegraph @@ -37,10 +37,19 @@ ### END INIT INFO # Variables -INSTALL_DIR= SERVER_PORT= -BIN_DIR=$INSTALL_DIR/bin +function abs_path() { + SOURCE="${BASH_SOURCE[0]}" + while [ -h "$SOURCE" ]; do + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + done + echo "$( cd -P "$( dirname "$SOURCE" )" && pwd )" +} + +BIN=`abs_path` SERVER_URL="http://localhost:${SERVER_PORT}" DETECT_URL="$SERVER_URL/versions" From 9abf9890ebcdd49a00a949027d806e9b433ad01a Mon Sep 17 00:00:00 2001 From: coderzc Date: Sun, 20 Nov 2022 22:31:30 +0800 Subject: [PATCH 2/4] Fix start shell --- .../src/assembly/static/bin/hugegraph | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph b/hugegraph-dist/src/assembly/static/bin/hugegraph index f75da2c04e..1a0712ccf8 100644 --- a/hugegraph-dist/src/assembly/static/bin/hugegraph +++ b/hugegraph-dist/src/assembly/static/bin/hugegraph @@ -37,24 +37,17 @@ ### END INIT INFO # Variables +# it requires user to set a fixed abs path manually +INSTALL_DIR= SERVER_PORT= -function abs_path() { - SOURCE="${BASH_SOURCE[0]}" - while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" - done - echo "$( cd -P "$( dirname "$SOURCE" )" && pwd )" -} - -BIN=`abs_path` +BIN_DIR=$INSTALL_DIR/bin SERVER_URL="http://localhost:${SERVER_PORT}" DETECT_URL="$SERVER_URL/versions" # Start the HugeGraphServer start() { + check_variables echo "Starting HugeGraphServer..." # Verify if the service is running get_status @@ -82,6 +75,7 @@ start() { # Stop the MATH stop() { + check_variables echo "Stopping HugeGraphServer..." # Verify if the service is running get_status @@ -131,6 +125,18 @@ get_status() { fi } +check_variables() { + if [ -z "$INSTALL_DIR" ]; then + echo "Please setting variables 'INSTALL_DIR'" + exit 1 + fi + + if [ -z "$SERVER_PORT" ]; then + echo "Please setting variables 'SERVER_PORT'" + exit 1 + fi +} + # Main logic case "$1" in start) From c7e8ea9bf95e3c260cad9c9d669caec4d2401d79 Mon Sep 17 00:00:00 2001 From: coderzc Date: Mon, 21 Nov 2022 17:07:51 +0800 Subject: [PATCH 3/4] address comment --- .../src/assembly/static/bin/hugegraph | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph b/hugegraph-dist/src/assembly/static/bin/hugegraph index 1a0712ccf8..fdb8fd5131 100644 --- a/hugegraph-dist/src/assembly/static/bin/hugegraph +++ b/hugegraph-dist/src/assembly/static/bin/hugegraph @@ -41,13 +41,15 @@ INSTALL_DIR= SERVER_PORT= +${INSTALL_DIR:?"Please setting variables 'INSTALL_DIR'"} +${SERVER_PORT:?"Please setting variables 'SERVER_PORT'"} + BIN_DIR=$INSTALL_DIR/bin SERVER_URL="http://localhost:${SERVER_PORT}" DETECT_URL="$SERVER_URL/versions" # Start the HugeGraphServer start() { - check_variables echo "Starting HugeGraphServer..." # Verify if the service is running get_status @@ -75,7 +77,6 @@ start() { # Stop the MATH stop() { - check_variables echo "Stopping HugeGraphServer..." # Verify if the service is running get_status @@ -125,18 +126,6 @@ get_status() { fi } -check_variables() { - if [ -z "$INSTALL_DIR" ]; then - echo "Please setting variables 'INSTALL_DIR'" - exit 1 - fi - - if [ -z "$SERVER_PORT" ]; then - echo "Please setting variables 'SERVER_PORT'" - exit 1 - fi -} - # Main logic case "$1" in start) From 58e8bf9d121dceca3c9e162e2f31856216e9fb50 Mon Sep 17 00:00:00 2001 From: imbajin Date: Mon, 21 Nov 2022 21:12:22 +0800 Subject: [PATCH 4/4] Update hugegraph --- hugegraph-dist/src/assembly/static/bin/hugegraph | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph b/hugegraph-dist/src/assembly/static/bin/hugegraph index fdb8fd5131..953608f89f 100644 --- a/hugegraph-dist/src/assembly/static/bin/hugegraph +++ b/hugegraph-dist/src/assembly/static/bin/hugegraph @@ -41,8 +41,8 @@ INSTALL_DIR= SERVER_PORT= -${INSTALL_DIR:?"Please setting variables 'INSTALL_DIR'"} -${SERVER_PORT:?"Please setting variables 'SERVER_PORT'"} +${INSTALL_DIR:?"Please set variables 'INSTALL_DIR'"} +${SERVER_PORT:?"Please set variables 'SERVER_PORT'"} BIN_DIR=$INSTALL_DIR/bin SERVER_URL="http://localhost:${SERVER_PORT}"