From 66405112b1f44cbd1ece20d45f348eae2933e95e Mon Sep 17 00:00:00 2001 From: Chris Hager Date: Tue, 21 Mar 2023 11:05:23 +0100 Subject: [PATCH] fixed scripts/export-bids-auto.sh (#320) --- scripts/export-bids-auto.sh | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/scripts/export-bids-auto.sh b/scripts/export-bids-auto.sh index fd04ee60..338f8dfb 100755 --- a/scripts/export-bids-auto.sh +++ b/scripts/export-bids-auto.sh @@ -25,19 +25,23 @@ echo "latest_slot_exported: $latestslot_exported" latestslot=$( curl -s https://beaconcha.in/latestState | jq '.lastProposedSlot' ) echo "latest slot: $latestslot" -# Compute latest slot to export -last_slot_to_export=$((latestslot_exported + BUCKET_SIZE)) -echo "last_slot_to_export: $last_slot_to_export" - -# End now if latest slot to export is in the future -if (( last_slot_to_export > latestslot )); then - echo "latest slot to export is in the future. exiting now" - exit 0 -fi - -# Export now +# Start at last exported slot +1 slot_start=$((latestslot_exported + 1)) -slot_end=$last_slot_to_export -cmd="$SCRIPT_DIR/export-bids.sh $slot_start $slot_end" -echo $cmd -$cmd + +# Now loop over buckets until all slots are exported +while true; do + slot_end=$((slot_start + BUCKET_SIZE - 1)) + echo "slots to export: $slot_start - $slot_end" + + # End now if latest slot to export is in the future + if (( slot_end > latestslot )); then + echo "latest slot to export is in the future. exiting now" + exit 0 + fi + + # Export now + cmd="$SCRIPT_DIR/export-bids.sh $slot_start $slot_end" + echo $cmd + $cmd + slot_start=$((slot_start + BUCKET_SIZE)) +done \ No newline at end of file