33export LANG=zh_CN.UTF-8
44set -e
55
6- HOME_PATH=` dirname $0 `
7- HOME_PATH=` cd ${HOME_PATH} /.. && pwd`
8- cd ${HOME_PATH}
6+ HOME_PATH=$( dirname " $0 " )
7+ HOME_PATH=$( cd " ${HOME_PATH} " /.. && pwd)
8+ cd " ${HOME_PATH} "
99
1010BIN_PATH=${HOME_PATH} /bin
1111CONF_PATH=${HOME_PATH} /conf
1212LIB_PATH=${HOME_PATH} /lib
1313LOG_PATH=${HOME_PATH} /logs
1414PID_FILE=${BIN_PATH} /pid
1515
16- . ${BIN_PATH} /common_functions
16+ . " ${BIN_PATH} " /common_functions
1717
1818print_usage () {
1919 echo " usage: start-hubble.sh [options]"
@@ -25,11 +25,12 @@ print_usage() {
2525java_env_check
2626
2727if [[ ! -d ${LOG_PATH} ]]; then
28- mkdir ${LOG_PATH}
28+ mkdir " ${LOG_PATH} "
2929fi
3030
3131class_path=" ."
32- for jar in ` ls ${LIB_PATH} /* .jar` ; do
32+ for jar in " ${LIB_PATH} " /* .jar; do
33+ [[ -e " $jar " ]] || break
3334 class_path=${class_path} :${jar}
3435done
3536
@@ -48,32 +49,32 @@ while [[ $# -gt 0 ]]; do
4849done
4950
5051if [[ -f ${PID_FILE} ]] ; then
51- pid=` cat ${PID_FILE} `
52- if kill -0 ${pid} > /dev/null 2>&1 ; then
52+ pid=$( cat " ${PID_FILE} " )
53+ if kill -0 " ${pid} " > /dev/null 2>&1 ; then
5354 echo " HugeGraphHubble is running as process ${pid} , please stop it first!"
5455 exit 1
5556 else
56- rm ${PID_FILE}
57+ rm " ${PID_FILE} "
5758 fi
5859fi
5960
6061main_class=" com.baidu.hugegraph.HugeGraphHubble"
6162args=${CONF_PATH} /hugegraph-hubble.properties
6263log=${LOG_PATH} /hugegraph-hubble.log
6364
64- echo -n " starting HugeGraphHubble"
65- nohup nice -n 0 java -server ${java_opts} -Dhubble.home.path=${HOME_PATH} -cp ${class_path} ${main_class} ${args} > ${log} 2>&1 < /dev/null &
65+ echo -n " starting HugeGraphHubble "
66+ nohup nice -n 0 java -server " ${java_opts} " -Dhubble.home.path=" ${HOME_PATH} " -cp " ${class_path} " ${main_class} " ${args} " > " ${log} " 2>&1 < /dev/null &
6667pid=$!
67- echo ${pid} > ${PID_FILE}
68+ echo ${pid} > " ${PID_FILE} "
6869
6970# wait hubble start
7071timeout_s=30
71- server_host=` read_property ${CONF_PATH} /hugegraph-hubble.properties server .host`
72- server_port=` read_property ${CONF_PATH} /hugegraph-hubble.properties server .port`
72+ server_host=$( read_property " ${CONF_PATH} " /hugegraph-hubble.properties hubble .host)
73+ server_port=$( read_property " ${CONF_PATH} " /hugegraph-hubble.properties hubble .port)
7374server_url=" http://${server_host} :${server_port} /actuator/health"
7475
75- wait_for_startup ${server_url} ${timeout_s} || {
76- cat ${log}
76+ wait_for_startup " ${server_url} " ${timeout_s} || {
77+ cat " ${log} "
7778 exit 1
7879}
79- echo " logging to ${log} "
80+ echo " logging to ${log} , please check it "
0 commit comments