stack-orchestrator/app/data/config/mainnet-eth/scripts/run-geth.sh

53 lines
1.2 KiB
Bash
Raw Normal View History

2023-07-24 04:54:55 +00:00
#!/bin/sh
2023-07-21 21:52:58 +00:00
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
set -x
fi
CERC_ETH_DATADIR=/root/ethdata
START_CMD="geth"
if [ "true" == "$CERC_REMOTE_DEBUG" ] && [ -x "/usr/local/bin/dlv" ]; then
START_CMD="/usr/local/bin/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /usr/local/bin/geth --continue --"
fi
# See https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script
cleanup() {
echo "Signal received, cleaning up..."
# Kill the child process first (CERC_REMOTE_DEBUG=true uses dlv which starts geth as a child process)
pkill -P ${geth_pid}
sleep 2
kill $(jobs -p)
wait
echo "Done"
}
$START_CMD \
--datadir="${CERC_ETH_DATADIR}" \
--authrpc.addr="0.0.0.0" \
2023-07-21 22:25:20 +00:00
--authrpc.port 8551 \
2023-07-21 21:52:58 +00:00
--authrpc.vhosts="*" \
2023-07-21 22:25:20 +00:00
--authrpc.jwtsecret="/etc/mainnet-eth/jwtsecret" \
2023-07-21 21:52:58 +00:00
--ws \
--ws.addr="0.0.0.0" \
--ws.origins="*" \
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
--http.corsdomain="*" \
2023-07-21 22:25:20 +00:00
--gcmode full \
2023-07-21 21:52:58 +00:00
--txlookuplimit=0 \
--cache.preimages \
2023-07-21 22:25:20 +00:00
--syncmode=snap \
2023-07-21 21:52:58 +00:00
&
geth_pid=$!
wait $geth_pid
if [ "true" == "$CERC_KEEP_RUNNING_AFTER_GETH_EXIT" ]; then
while [ 1 -eq 1 ]; do
sleep 60
done
fi