fix(bin/emqx): turn off debug print when need to capture stderror
This commit is contained in:
parent
d9a5f53601
commit
8151f79f45
17
bin/emqx
17
bin/emqx
|
@ -5,9 +5,7 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
DEBUG="${DEBUG:-0}"
|
DEBUG="${DEBUG:-0}"
|
||||||
if [ "$DEBUG" -eq 1 ]; then
|
[ "$DEBUG" -eq 1 ] && set -x
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
RUNNER_ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)"
|
RUNNER_ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)"
|
||||||
|
|
||||||
|
@ -40,9 +38,12 @@ export ERTS_LIB_DIR="$RUNNER_ROOT_DIR/lib"
|
||||||
DYNLIBS_DIR="$RUNNER_ROOT_DIR/dynlibs"
|
DYNLIBS_DIR="$RUNNER_ROOT_DIR/dynlibs"
|
||||||
|
|
||||||
# Echo to stderr on errors
|
# Echo to stderr on errors
|
||||||
echoerr() { echo -e "$*" 1>&2; }
|
echoerr() {
|
||||||
|
echo -e "$*" 1>&2;
|
||||||
|
}
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
|
set +x
|
||||||
echoerr "ERROR: $1"
|
echoerr "ERROR: $1"
|
||||||
errno=${2:-1}
|
errno=${2:-1}
|
||||||
exit "$errno"
|
exit "$errno"
|
||||||
|
@ -300,6 +301,8 @@ if [ "$IS_BOOT_COMMAND" = 'yes' ]; then
|
||||||
if [ "$LD_LIBRARY_PATH" != "$DYNLIBS_DIR" ]; then
|
if [ "$LD_LIBRARY_PATH" != "$DYNLIBS_DIR" ]; then
|
||||||
export LD_LIBRARY_PATH="$DYNLIBS_DIR:$LD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="$DYNLIBS_DIR:$LD_LIBRARY_PATH"
|
||||||
fi
|
fi
|
||||||
|
## Turn off debug, because COMPATIBILITY_INFO needs to capture stderr
|
||||||
|
set +x
|
||||||
COMPATIBILITY_INFO="$(compatiblity_info 2>&1 || true)"
|
COMPATIBILITY_INFO="$(compatiblity_info 2>&1 || true)"
|
||||||
if ! (echo -e "$COMPATIBILITY_INFO" | grep -q 'BEAM_OK'); then
|
if ! (echo -e "$COMPATIBILITY_INFO" | grep -q 'BEAM_OK'); then
|
||||||
## not able to start beam.smp
|
## not able to start beam.smp
|
||||||
|
@ -316,7 +319,7 @@ if [ "$IS_BOOT_COMMAND" = 'yes' ]; then
|
||||||
fi
|
fi
|
||||||
echoerr "Using libs from '${DYNLIBS_DIR}' due to missing from the OS."
|
echoerr "Using libs from '${DYNLIBS_DIR}' due to missing from the OS."
|
||||||
fi
|
fi
|
||||||
export COMPATIBILITY_INFO
|
[ "$DEBUG" -eq 1 ] && set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NO_EPMD="-start_epmd false -epmd_module ekka_epmd -proto_dist ekka"
|
NO_EPMD="-start_epmd false -epmd_module ekka_epmd -proto_dist ekka"
|
||||||
|
@ -606,6 +609,7 @@ latest_vm_args() {
|
||||||
if [ -f "$vm_args_file" ]; then
|
if [ -f "$vm_args_file" ]; then
|
||||||
echo "$vm_args_file"
|
echo "$vm_args_file"
|
||||||
else
|
else
|
||||||
|
set +x
|
||||||
echoerr "Node not initialized?"
|
echoerr "Node not initialized?"
|
||||||
echoerr "Generated config file vm.*.args is not found for command '$COMMAND'"
|
echoerr "Generated config file vm.*.args is not found for command '$COMMAND'"
|
||||||
echoerr "in config dir: $CONFIGS_DIR"
|
echoerr "in config dir: $CONFIGS_DIR"
|
||||||
|
@ -785,8 +789,7 @@ case "${COMMAND}" in
|
||||||
# Wait for the node to completely stop...
|
# Wait for the node to completely stop...
|
||||||
PID="$(relx_get_pid)"
|
PID="$(relx_get_pid)"
|
||||||
if ! relx_nodetool "stop"; then
|
if ! relx_nodetool "stop"; then
|
||||||
echoerr "Graceful shutdown failed PID=[$PID]"
|
die "Graceful shutdown failed PID=[$PID]"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
WAIT_TIME="${EMQX_WAIT_FOR_STOP:-120}"
|
WAIT_TIME="${EMQX_WAIT_FOR_STOP:-120}"
|
||||||
if ! wait_for "$WAIT_TIME" 'is_down' "$PID"; then
|
if ! wait_for "$WAIT_TIME" 'is_down' "$PID"; then
|
||||||
|
|
Loading…
Reference in New Issue