diff --git a/bin/node_dump b/bin/node_dump index 056b9a822..c8f76841b 100755 --- a/bin/node_dump +++ b/bin/node_dump @@ -2,14 +2,16 @@ set -eu ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)" - echo "Running node dump in ${ROOT_DIR}" +# shellcheck disable=SC1090 +. "$ROOT_DIR"/releases/emqx_vars + cd "${ROOT_DIR}" -DUMP="log/node_dump_$(date +"%Y%m%d_%H%M%S").tar.gz" -CONF_DUMP="log/conf.dump" -SYSINFO="log/sysinfo.txt" +DUMP="$RUNNER_LOG_DIR/node_dump_$(date +"%Y%m%d_%H%M%S").tar.gz" +CONF_DUMP="$RUNNER_LOG_DIR/conf.dump" +SYSINFO="$RUNNER_LOG_DIR/sysinfo.txt" LOG_MAX_AGE_DAYS=3 @@ -26,7 +28,7 @@ show_help() { USAGE: - bin/node_dump [-a DAYS] + $0 [-a DAYS] OPTIONS: @@ -44,29 +46,29 @@ done # Collect system info: { - collect bin/emqx_ctl broker - collect bin/emqx eval "'emqx_node_dump:sys_info()'" + collect "$RUNNER_BIN_DIR"/emqx_ctl broker + collect "$RUNNER_BIN_DIR"/emqx eval "'emqx_node_dump:sys_info()'" collect uname -a collect uptime collect free collect netstat -tnl - collect bin/emqx_ctl plugins list - collect bin/emqx_ctl modules list + collect "$RUNNER_BIN_DIR"/emqx_ctl plugins list + collect "$RUNNER_BIN_DIR"/emqx_ctl modules list - collect bin/emqx_ctl vm all - collect bin/emqx_ctl listeners + collect "$RUNNER_BIN_DIR"/emqx_ctl vm all + collect "$RUNNER_BIN_DIR"/emqx_ctl listeners } > "${SYSINFO}" # Collect information about the configuration: { - collect bin/emqx eval "'emqx_node_dump:app_env_dump()'" + collect "$RUNNER_BIN_DIR"/emqx eval "'emqx_node_dump:app_env_dump()'" } > "${CONF_DUMP}" # Pack files { - find log -mtime -"${LOG_MAX_AGE_DAYS}" \( -name '*.log.*' -or -name 'run_erl.log*' \) + find "$RUNNER_LOG_DIR" -mtime -"${LOG_MAX_AGE_DAYS}" \( -name '*.log.*' -or -name 'run_erl.log*' \) echo "${SYSINFO}" echo "${CONF_DUMP}" } | tar czf "${DUMP}" -T -