From 1e7a4188d2890b00b4228bdc8e88961de0ba57e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sat, 2 May 2020 00:09:04 +0200 Subject: [PATCH] launch_local_testnet.sh: dump logs more often --- scripts/launch_local_testnet.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/launch_local_testnet.sh b/scripts/launch_local_testnet.sh index 773a8081b..636725c46 100755 --- a/scripts/launch_local_testnet.sh +++ b/scripts/launch_local_testnet.sh @@ -150,6 +150,15 @@ cleanup() { } trap 'cleanup' SIGINT SIGTERM EXIT +dump_logs() { + LOG_LINES=20 + for LOG in "${DATA_DIR}"/log*.txt; do + echo "Last ${LOG_LINES} lines of ${LOG}:" + tail -n ${LOG_LINES} "${LOG}" + echo "======" + done +} + PIDS="" NODES_WITH_VALIDATORS=${NODES_WITH_VALIDATORS:-4} VALIDATORS_PER_NODE=$(( $RANDOM_VALIDATORS / $NODES_WITH_VALIDATORS )) @@ -167,6 +176,7 @@ for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do NOW_TIMESTAMP=$(date +%s) if [[ "$(( NOW_TIMESTAMP - START_TIMESTAMP ))" -ge "$BOOTSTRAP_TIMEOUT" ]]; then echo "Bootstrap node failed to start in ${BOOTSTRAP_TIMEOUT} seconds. Aborting." + dump_logs exit 1 fi done @@ -205,6 +215,7 @@ sleep 5 BG_JOBS="$(jobs | wc -l)" if [[ "$BG_JOBS" != "$NUM_NODES" ]]; then echo "$((NUM_NODES - BG_JOBS)) beacon_node instance(s) exited early. Aborting." + dump_logs exit 1 fi @@ -218,12 +229,7 @@ else done if [[ "$FAILED" != "0" ]]; then echo "${FAILED} child processes had non-zero exit codes (or exited early)." - LOG_LINES=20 - for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do - echo "Last ${LOG_LINES} lines of ${DATA_DIR}/log${NUM_NODE}.txt:" - tail -n ${LOG_LINES} "${DATA_DIR}/log${NUM_NODE}.txt" - echo "======" - done + dump_logs exit 1 fi fi