Changeset View
Changeset View
Standalone View
Standalone View
contrib/seeds/test-seeds.sh
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | if [ ! -x "${BITCOIND}" ]; then | ||||
echo "${BITCOIND} does not exist or has incorrect permissions." | echo "${BITCOIND} does not exist or has incorrect permissions." | ||||
exit 10 | exit 10 | ||||
fi | fi | ||||
if [ ! -x "${BITCOIN_CLI}" ]; then | if [ ! -x "${BITCOIN_CLI}" ]; then | ||||
echo "${BITCOIN_CLI} does not exist or has incorrect permissions." | echo "${BITCOIN_CLI} does not exist or has incorrect permissions." | ||||
exit 11 | exit 11 | ||||
fi | fi | ||||
BITCOIND="${BITCOIND} -connect=0 ${OPTION_TESTNET}" | BITCOIND="${BITCOIND} -connect=0 ${OPTION_TESTNET} -daemon" | ||||
BITCOIN_CLI="${BITCOIN_CLI} ${OPTION_TESTNET}" | BITCOIN_CLI="${BITCOIN_CLI} ${OPTION_TESTNET}" | ||||
>&2 echo "Spinning up bitcoind..." | >&2 echo "Spinning up bitcoind..." | ||||
${BITCOIND} & | ${BITCOIND} | ||||
BITCOIND_PID=$! | |||||
cleanup() { | cleanup() { | ||||
# Cleanup background processes spawned by this script. | # Cleanup background processes spawned by this script. | ||||
>&2 echo "Cleaning up bitcoin daemon (PID: ${BITCOIND_PID})." | >&2 echo "Cleaning up bitcoin daemon..." | ||||
kill ${BITCOIND_PID} | ${BITCOIN_CLI} stop | ||||
} | } | ||||
trap "cleanup" EXIT | trap "cleanup" EXIT | ||||
# Short sleep to make sure the RPC server is available | # Short sleep to make sure the RPC server is available | ||||
sleep 0.1 | sleep 0.1 | ||||
# Wait until bitcoind is fully spun up | # Wait until bitcoind is fully spun up | ||||
WARMUP_TIMEOUT=60 | WARMUP_TIMEOUT=60 | ||||
for _ in $(seq 1 ${WARMUP_TIMEOUT}); do | for _ in $(seq 1 ${WARMUP_TIMEOUT}); do | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |