mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-27 06:47:13 +00:00
launch_local_testnet.sh: fix terminating Geth (#4684)
Also improve logging and list jobs after cleanup. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
3681177cf4
commit
2f36f15b20
@ -746,15 +746,15 @@ cleanup() {
|
|||||||
echo "Existing processes:"
|
echo "Existing processes:"
|
||||||
for proc in "${PROCS_TO_KILL[@]}"; do
|
for proc in "${PROCS_TO_KILL[@]}"; do
|
||||||
PROC_NAME=$(basename "$proc")
|
PROC_NAME=$(basename "$proc")
|
||||||
pgrep -alf "${PROC_NAME}" || true
|
pgrep -al "${PROC_NAME}" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Terminating:"
|
echo "Terminating:"
|
||||||
for proc in "${PROCS_TO_KILL[@]}"; do
|
for proc in "${PROCS_TO_KILL[@]}"; do
|
||||||
PROC_NAME=$(basename "$proc")
|
PROC_NAME=$(basename "$proc")
|
||||||
|
echo -n "Terminating ${PROC_NAME}: " >&2
|
||||||
# WARNING: The '-P $$' avoids killing unrelated processes.
|
# WARNING: The '-P $$' avoids killing unrelated processes.
|
||||||
pkill -SIGTERM "${PKILL_ECHO_FLAG}" -P $$ "${PROC_NAME}" \
|
pkill -SIGTERM "${PKILL_ECHO_FLAG}" -P $$ "${PROC_NAME}" || true
|
||||||
|| echo "Nothing to terminate: ${PROC_NAME}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
@ -762,9 +762,9 @@ cleanup() {
|
|||||||
echo "Killing:"
|
echo "Killing:"
|
||||||
for proc in "${PROCS_TO_KILL[@]}"; do
|
for proc in "${PROCS_TO_KILL[@]}"; do
|
||||||
PROC_NAME=$(basename "$proc")
|
PROC_NAME=$(basename "$proc")
|
||||||
|
echo -n "Killing ${PROC_NAME}: " >&2
|
||||||
# WARNING: The '-P $$' avoids killing unrelated processes.
|
# WARNING: The '-P $$' avoids killing unrelated processes.
|
||||||
pkill -SIGKILL "${PKILL_ECHO_FLAG}" -P $$ "${PROC_NAME}" \
|
pkill -SIGKILL "${PKILL_ECHO_FLAG}" -P $$ "${PROC_NAME}" || true
|
||||||
|| echo "Nothing to kill: ${PROC_NAME}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Delete all binaries we just built, because these are unusable outside this
|
# Delete all binaries we just built, because these are unusable outside this
|
||||||
@ -786,6 +786,9 @@ cleanup() {
|
|||||||
rm -rf "${dir}"
|
rm -rf "${dir}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Jobs status after cleanup:"
|
||||||
|
jobs
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'cleanup' SIGINT SIGTERM EXIT
|
trap 'cleanup' SIGINT SIGTERM EXIT
|
||||||
|
@ -12,11 +12,9 @@ GETH_ENODES=()
|
|||||||
|
|
||||||
log "Using ${GETH_BINARY}"
|
log "Using ${GETH_BINARY}"
|
||||||
|
|
||||||
start_geth_node() {
|
for GETH_NODE_IDX in $(seq 0 $GETH_LAST_NODE_IDX); do
|
||||||
GETH_NODE_IDX=$1
|
|
||||||
mkdir -p "${GETH_DATA_DIRS[GETH_NODE_IDX]}"
|
mkdir -p "${GETH_DATA_DIRS[GETH_NODE_IDX]}"
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
${GETH_BINARY} version
|
${GETH_BINARY} version
|
||||||
${GETH_BINARY} --datadir "${GETH_DATA_DIRS[GETH_NODE_IDX]}" init "${EXECUTION_GENESIS_JSON}"
|
${GETH_BINARY} --datadir "${GETH_DATA_DIRS[GETH_NODE_IDX]}" init "${EXECUTION_GENESIS_JSON}"
|
||||||
${GETH_BINARY} \
|
${GETH_BINARY} \
|
||||||
@ -27,12 +25,9 @@ start_geth_node() {
|
|||||||
--http.port ${GETH_RPC_PORTS[GETH_NODE_IDX]} \
|
--http.port ${GETH_RPC_PORTS[GETH_NODE_IDX]} \
|
||||||
--port ${GETH_NET_PORTS[GETH_NODE_IDX]} \
|
--port ${GETH_NET_PORTS[GETH_NODE_IDX]} \
|
||||||
--authrpc.port ${GETH_AUTH_RPC_PORTS[GETH_NODE_IDX]} \
|
--authrpc.port ${GETH_AUTH_RPC_PORTS[GETH_NODE_IDX]} \
|
||||||
--authrpc.jwtsecret "${JWT_FILE}"
|
--authrpc.jwtsecret "${JWT_FILE}" \
|
||||||
}
|
&> "${DATA_DIR}/geth-log${GETH_NODE_IDX}.txt" &
|
||||||
|
set +x
|
||||||
for GETH_NODE_IDX in $(seq 0 $GETH_LAST_NODE_IDX); do
|
|
||||||
start_geth_node $GETH_NODE_IDX \
|
|
||||||
&> "${DATA_DIR}/geth-log${GETH_NODE_IDX}.txt" &
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for GETH_NODE_IDX in $(seq 0 $GETH_LAST_NODE_IDX); do
|
for GETH_NODE_IDX in $(seq 0 $GETH_LAST_NODE_IDX); do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user