Skip to content

Commit

Permalink
Fix start shell
Browse files Browse the repository at this point in the history
  • Loading branch information
coderzc committed Nov 20, 2022
1 parent 05d49f1 commit 9abf989
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions hugegraph-dist/src/assembly/static/bin/hugegraph
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -82,6 +75,7 @@ start() {

# Stop the MATH
stop() {
check_variables
echo "Stopping HugeGraphServer..."
# Verify if the service is running
get_status
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9abf989

Please sign in to comment.