diff --git a/bin/emqx b/bin/emqx index c32c00474..dab7c230b 100755 --- a/bin/emqx +++ b/bin/emqx @@ -341,7 +341,7 @@ COMPATIBILITY_CHECK=' end, halt(0). ' -[ "$DEBUG" -eq 1 ] && set -x +[[ "$DEBUG" -gt 0 ]] && set -x compatiblity_info() { # RELEASE_LIB is used by Elixir @@ -569,7 +569,7 @@ else fi fi logdebug "EMQX_BOOT_CONFIGS: $EMQX_BOOT_CONFIGS" -[ "$DEBUG" -eq 1 ] && set -x +[[ "$DEBUG" -gt 0 ]] && set -x get_boot_config() { path_to_value="$1" @@ -1250,6 +1250,12 @@ case "${COMMAND}" in # Build an array of arguments to pass to exec later on # Build it here because this command will be used for logging. if [ "$IS_ELIXIR" = no ] || [ "${EMQX_CONSOLE_FLAVOR:-}" = 'erl' ] ; then + if [[ "$DEBUG" == 2 ]]; then + INIT_DEBUG_ARG="-init_debug" + else + INIT_DEBUG_ARG="" + fi + # pass down RELEASE_LIB so we can switch to IS_ELIXIR=no # to boot an Erlang node from the elixir release set -- "$BINDIR/erlexec" \ @@ -1260,8 +1266,15 @@ case "${COMMAND}" in -mode "$CODE_LOADING_MODE" \ -config "$CONF_FILE" \ -args_file "$ARGS_FILE" \ + $INIT_DEBUG_ARG \ $EPMD_ARGS else + if [[ "$DEBUG" == 2 ]]; then + INIT_DEBUG_ARG="--erl -init_debug" + else + INIT_DEBUG_ARG="" + fi + set -- "$REL_DIR/iex" \ --boot "$BOOTFILE" \ --boot-var RELEASE_LIB "${ERTS_LIB_DIR}" \ @@ -1270,6 +1283,7 @@ case "${COMMAND}" in --erl "$FOREGROUNDOPTIONS" \ --erl "-mode $CODE_LOADING_MODE" \ --erl "$EPMD_ARGS" \ + $INIT_DEBUG_ARG \ --werl fi