Files
ethereum-rpc-docker/clone-backup.sh
Sebastian 6752469c8d fix
2024-10-28 10:45:56 +01:00

30 lines
611 B
Bash
Executable File

#!/bin/bash
dir="$(dirname "$0")"
# FTP server details
LOCAL_DIR="/backup"
mkdir -p "$LOCAL_DIR"
keys=$(cat $dir/$2.yml | yaml2json - | jq '.volumes' | jq -r 'keys[]')
files=()
for key in $keys; do
volume_name="rpc_$key-20" # needs to be followed by a date 2024
need_to_copy_file=$($dir/list-backups.sh $1 | grep "${volume_name}" | sort | tail -n 1)
#echo "Download: $need_to_copy_file"
files+=("$need_to_copy_file")
done
if [ "$3" = "--print-timestamp-only" ]; then
echo "${files[@]}"
exit 0
fi
base_url="$1"
aria2c -c -Z -x8 -j8 -s8 -d "$LOCAL_DIR" "${files[@]/#/$base_url}"