Skip to content

Commit

Permalink
fix: make bigdipper.sh even more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Nov 12, 2020
1 parent 9f2383e commit 00b76a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/deployment/bigdipper/bigdipper.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#! /bin/bash
# bigdipper.sh - Run Agoric Big Dipper Explorer
set -e

# Kill off all our children on exit.
trap 'kill $(jobs -p) 2>/dev/null' EXIT
Expand All @@ -11,6 +10,9 @@ cn=`echo "$ncf" | jq -r '.chainName'`

origRpcAddrs=( $(echo $ncf | jq -r '.rpcAddrs | join(" ")' ) )

# Begin detecting errors.
set -e

rpcAddrs=(${origRpcAddrs[@]})
rp=
while [[ ${#rpcAddrs[@]} -gt 0 ]]; do
Expand Down Expand Up @@ -45,15 +47,19 @@ test -d "portal-$cn" && ln -sfT "portal-$cn" "portal-$nn"
cd "portal-$nn"
export METEOR_SETTINGS=`sed -e "s/@GTM@/$GTM/; s/@CHAIN_NAME@/$cn/; s!@NETWORK_URL@!$NETWORK_URL!; s/@RPC@/$rp/; s/@API@/$api/;" settings.json`

/usr/bin/node main.js &

# Kill this script if the ping fails.
# Systemd restarts us and we refresh our parameters.
{
while $ping > /dev/null; do
newcn=`curl -Ss "$NETWORK_URL/network-config" | jq -r .chainName`
test "$cn" == "$newcn" || break
sleep 30
done
sleep 20
kill $$
} &

/usr/bin/node main.js
wait
exit $?

0 comments on commit 00b76a3

Please sign in to comment.