Skip to content

Commit

Permalink
fix(dist): avoid var PRELOAD cover environmnet vars (#2302)
Browse files Browse the repository at this point in the history
Update hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh

---------

Co-authored-by: imbajin <jin@apache.org>
  • Loading branch information
aroundabout and imbajin committed Nov 10, 2023
1 parent 51df7ec commit 4ad5418
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,29 @@
OPEN_MONITOR="false"
OPEN_SECURITY_CHECK="true"
DAEMON="true"
PRELOAD="false"
#VERBOSE=""
GC_OPTION=""
USER_OPTION=""
SERVER_STARTUP_TIMEOUT_S=30
# todo: move abs_path funtion to shell like util.sh
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
cd -P "$(dirname "$SOURCE")" && pwd
}

BIN=$(abs_path)
TOP="$(cd "$BIN"/../ && pwd)"
CONF="$TOP/conf"
LOGS="$TOP/logs"
SCRIPTS="$TOP/scripts"
PID_FILE="$BIN/pid"

. "$BIN"/util.sh

while getopts "d:g:m:p:s:j:t:v" arg; do
case ${arg} in
Expand All @@ -35,45 +53,19 @@ while getopts "d:g:m:p:s:j:t:v" arg; do
t) SERVER_STARTUP_TIMEOUT_S="$OPTARG" ;;
# TODO: should remove it in future (check the usage carefully)
v) VERBOSE="verbose" ;;
?) echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] [-s true|false] [-j java_options]
[-t timeout]" && exit 1 ;;
# Note: update usage info when the params changed
?) exit_with_usage_help ;;
esac
done

if [[ "$OPEN_MONITOR" != "true" && "$OPEN_MONITOR" != "false" ]]; then
echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] [-s true|false] [-j java_options]"
exit 1
exit_with_usage_help
fi

if [[ "$OPEN_SECURITY_CHECK" != "true" && "$OPEN_SECURITY_CHECK" != "false" ]]; then
echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] [-s true|false] [-j java_options]"
exit 1
fi

if [[ "$PRELOAD" != "true" && "$PRELOAD" != "false" ]]; then
echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] [-s true|false] [-j java_options]"
exit 1
exit_with_usage_help
fi

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
cd -P "$(dirname "$SOURCE")" && pwd
}

BIN=$(abs_path)
TOP="$(cd "$BIN"/../ && pwd)"
CONF="$TOP/conf"
LOGS="$TOP/logs"
SCRIPTS="$TOP/scripts"
PID_FILE="$BIN/pid"

. "$BIN"/util.sh

GREMLIN_SERVER_URL=$(read_property "$CONF/rest-server.properties" "gremlinserver.url")
if [ -z "$GREMLIN_SERVER_URL" ]; then
GREMLIN_SERVER_URL="http://127.0.0.1:8182"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,8 @@ function kill_process_and_wait() {
kill_process "$process_name" "$pid"
wait_for_shutdown "$process_name" "$pid" "$timeout_s"
}

function exit_with_usage_help(){
echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] [-s true|false] [-j java_options] [-t timeout]"
exit 1
}

0 comments on commit 4ad5418

Please sign in to comment.