#!/bin/bash set -e set -o pipefail if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi echo "Using the following env:" echo "CERC_NETWORK: ${CERC_NETWORK}" echo "CERC_LIGHTHOUSE_DATADIR: ${CERC_LIGHTHOUSE_DATADIR}" echo "CERC_CHECKPOINT_SYNC_URL: ${CERC_CHECKPOINT_SYNC_URL}" echo "CERC_DEBUG_LEVEL: ${CERC_DEBUG_LEVEL}" echo "ETH_ENDPOINT: ${ETH_ENDPOINT}" echo "EXECUTION_ENDPOINT: ${EXECUTION_ENDPOINT}" # See https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script cleanup() { echo "Signal received, cleaning up..." kill $(jobs -p) wait echo "Done" } trap 'cleanup' SIGINT SIGTERM jwtsecret_file_path=/opt/jwtsecret echo -n "$JWT" > $jwtsecret_file_path http_port=8001 lighthouse bn \ --network $CERC_NETWORK \ --datadir $CERC_LIGHTHOUSE_DATADIR/$CERC_NETWORK \ --execution-endpoint $EXECUTION_ENDPOINT \ --execution-jwt $jwtsecret_file_path \ --checkpoint-sync-url $CERC_CHECKPOINT_SYNC_URL \ --disable-deposit-contract-sync \ --debug-level $CERC_DEBUG_LEVEL \ --http \ --http-address 0.0.0.0 \ --http-port $http_port \ 2>&1 | tee /var/log/lighthouse_bn.log & beacon_pid=$! wait $beacon_pid