Created
September 3, 2024 12:31
-
-
Save notwedtm/567498288179d324187a644312231987 to your computer and use it in GitHub Desktop.
Download Solana
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SAVE_DIR="/mnt/data/cars" | |
BASE_URL="https://files.old-faithful.net" | |
MAX_PARALLEL=20 | |
START_EPOCH=651 | |
END_EPOCH=0 | |
# Create save directory if it doesn't exist | |
mkdir -p "$SAVE_DIR" | |
# Function to download a single epoch file | |
download_epoch() { | |
local epoch=$1 | |
local url="${BASE_URL}/${epoch}/epoch-${epoch}.car" | |
local filename="${SAVE_DIR}/epoch-${epoch}.car" | |
echo "Downloading epoch $epoch..." | |
wget --show-progress --progress=bar:force:noscroll \ | |
--tries=3 --continue \ | |
-O "$filename" "$url" | |
if [ $? -eq 0 ]; then | |
echo "Epoch $epoch: Download completed." | |
else | |
echo "Error downloading epoch $epoch. Please check and retry manually." | |
fi | |
} | |
export -f download_epoch | |
export SAVE_DIR BASE_URL | |
# Use parallel to download files concurrently | |
seq $START_EPOCH -1 $END_EPOCH | \ | |
parallel --jobs $MAX_PARALLEL --bar download_epoch | |
echo "All downloads completed." | |
echo "Files saved in: $SAVE_DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment