rsync/airdrop only if ledger doesn't exist (eg, on first run after setup.sh)

This commit is contained in:
Michael Vines
2019-01-18 13:06:16 -08:00
committed by Grimes
parent a8bf00fe20
commit 303289777f

View File

@@ -163,6 +163,8 @@ fi
exit 1
}
tune_system
rsync_url() { # adds the 'rsync://` prefix to URLs that need it
declare url="$1"
@@ -183,10 +185,8 @@ rsync_url() { # adds the 'rsync://` prefix to URLs that need it
}
rsync_leader_url=$(rsync_url "$leader")
tune_system
set -ex
if [[ ! -d "$ledger_config_dir" ]]; then
$rsync -vPr "$rsync_leader_url"/config/ledger/ "$ledger_config_dir"
[[ -d $ledger_config_dir ]] || {
echo "Unable to retrieve ledger from $rsync_leader_url"
@@ -215,6 +215,7 @@ while true; do
echo "Airdrop failed. Remaining retries: $retries"
sleep 1
done
fi
trap 'kill "$pid" && wait "$pid"' INT TERM
# shellcheck disable=SC2086 # Don't want to double quote # maybe_rpc_port