You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2023/02/22 16:27:32 UTC
[incubator-hugegraph] 01/01: Update start-hugegraph.sh
This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch docker
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
commit f80cb103826cda1d0dc54dcdada8da20037cbdf4
Author: imbajin <ji...@apache.org>
AuthorDate: Thu Feb 23 00:14:26 2023 +0800
Update start-hugegraph.sh
---
.../src/assembly/static/bin/start-hugegraph.sh | 27 ++++++++++++++--------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh b/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
index 7a5585281..e75601f48 100644
--- a/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
+++ b/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
@@ -17,20 +17,23 @@
#
OPEN_MONITOR="false"
OPEN_SECURITY_CHECK="true"
+DAEMON="true"
VERBOSE=""
GC_OPTION=""
USER_OPTION=""
SERVER_STARTUP_TIMEOUT_S=30
-while getopts "g:m:s:j:t:v" arg; do
+while getopts "d:g:m:s:j:t" arg; do
case ${arg} in
+ d) DAEMON="$OPTARG" ;;
g) GC_OPTION="$OPTARG" ;;
m) OPEN_MONITOR="$OPTARG" ;;
s) OPEN_SECURITY_CHECK="$OPTARG" ;;
j) USER_OPTION="$OPTARG" ;;
t) SERVER_STARTUP_TIMEOUT_S="$OPTARG" ;;
- v) VERBOSE="verbose" ;;
- ?) echo "USAGE: $0 [-g g1] [-m true|false] [-s true|false] [-j java_options] [-t timeout] [-v]" && exit 1 ;;
+ #v) VERBOSE="verbose" ;;
+ ?) echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-s true|false] [-j java_options] \
+ [-t timeout]" && exit 1 ;;
esac
done
@@ -47,11 +50,11 @@ fi
function abs_path() {
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ DIR="$(cd -P "$(dirname "$SOURCE")" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
- echo "$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ cd -P "$(dirname "$SOURCE")" && pwd
}
BIN=$(abs_path)
@@ -77,8 +80,13 @@ fi
echo "Starting HugeGraphServer..."
-${BIN}/hugegraph-server.sh ${CONF}/gremlin-server.yaml ${CONF}/rest-server.properties \
-${OPEN_SECURITY_CHECK} ${USER_OPTION} ${GC_OPTION} >>${LOGS}/hugegraph-server.log 2>&1 &
+#if [[ $DAEMON == "false" ]]; then
+# exec "${BIN}"/hugegraph-server.sh "${CONF}"/gremlin-server.yaml "${CONF}"/rest-server.properties \
+# "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}" >>"${LOGS}"/hugegraph-server.log 2>&1
+#fi
+
+exec "${BIN}"/hugegraph-server.sh "${CONF}"/gremlin-server.yaml "${CONF}"/rest-server.properties \
+"${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}" >>"${LOGS}"/hugegraph-server.log 2>&1 &
PID="$!"
# Write pid to file
@@ -86,15 +94,14 @@ echo "$PID" > "$PID_FILE"
trap 'kill $PID; exit' SIGHUP SIGINT SIGQUIT SIGTERM
-wait_for_startup ${PID} 'HugeGraphServer' "$REST_SERVER_URL/graphs" ${SERVER_STARTUP_TIMEOUT_S} || {
+wait_for_startup ${PID} 'HugeGraphServer' "$REST_SERVER_URL/graphs" "${SERVER_STARTUP_TIMEOUT_S}" || {
echo "See $LOGS/hugegraph-server.log for HugeGraphServer log output." >&2
exit 1
}
disown
if [ "$OPEN_MONITOR" == "true" ]; then
- "$BIN"/start-monitor.sh
- if [ $? -ne 0 ]; then
+ if ! "$BIN"/start-monitor.sh; then
echo "Failed to open monitor, please start it manually"
fi
echo "An HugeGraphServer monitor task has been append to crontab"