From 9abf9890ebcdd49a00a949027d806e9b433ad01a Mon Sep 17 00:00:00 2001 From: coderzc Date: Sun, 20 Nov 2022 22:31:30 +0800 Subject: [PATCH] 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)