diff --git a/bin/emqx b/bin/emqx index 167cd5cf1..69994389b 100755 --- a/bin/emqx +++ b/bin/emqx @@ -260,15 +260,43 @@ if [ -z "$RELX_CONFIG_PATH" ]; then fi fi +IS_BOOT_COMMAND='no' +case "$1" in + start|start_boot) + IS_BOOT_COMMAND='yes' + ;; + console|console_clean|console_boot) + IS_BOOT_COMMAND='yes' + ;; + foreground) + IS_BOOT_COMMAND='yes' + ;; +esac + + if [ -z "$NAME_ARG" ]; then NODENAME="${EMQX_NODE_NAME:-}" # compatible with docker entrypoint [ -z "$NODENAME" ] && [ -n "$EMQX_NAME" ] && [ -n "$EMQX_HOST" ] && NODENAME="${EMQX_NAME}@${EMQX_HOST}" - [ -z "$NODENAME" ] && NODENAME=$(grep -E '^[ \t]*node.name[ \t]*=[ \t]*' "$RUNNER_ETC_DIR/emqx.conf" 2> /dev/null | tail -1 | cut -d = -f 2-) + if [ -z "$NODENAME" ] && [ "$IS_BOOT_COMMAND" = 'no' ]; then + # for non-boot commands, inspect vm.