From 9bc732784e46e7cc9838ebb9b1e278af54c05d49 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 8 Jan 2024 15:22:19 +0100 Subject: [PATCH] fix(bin/emqx): check app status in bash script Prior to this change, 'true=emqx:is_running().' Erlang assertion is evaluated before 'emqx start' command gives up waiting. The Erlang assertion would result in a error level crash log which can be confusing. This commit changes the equals to 'true' check to bash script instead. Also deleted the log message which advised users to report an issue in case timeout happens, because daemon mode is almost only used in tests --- bin/emqx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/emqx b/bin/emqx index 5b61042d7..f7ad1c04b 100755 --- a/bin/emqx +++ b/bin/emqx @@ -988,6 +988,7 @@ fi diagnose_boot_failure_and_die() { local ps_line + local app_status ps_line="$(find_emqx_process)" if [ -z "$ps_line" ]; then echo "Find more information in the latest log file: ${EMQX_LOG_DIR}/erlang.log.*" @@ -999,9 +1000,9 @@ diagnose_boot_failure_and_die() { pipe_shutdown exit 2 fi - if ! relx_nodetool 'eval' 'true = emqx:is_running()' > /dev/null; then + app_status="$(relx_nodetool 'eval' 'emqx:is_running()')" + if [ "$app_status" != 'true' ]; then logerr "$NAME node is started, but failed to complete the boot sequence in time." - echo "Please collect the logs in ${EMQX_LOG_DIR} and report a bug to EMQX team at https://github.com/emqx/emqx/issues/new/choose" pipe_shutdown exit 3 fi