do the thing

This commit is contained in:
Sebastian
2024-09-16 12:04:27 +02:00
parent 9134e3d21f
commit afa19bb887
2 changed files with 31 additions and 0 deletions

27
clone-backup.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
dir="$(dirname "$0")"
# FTP server details
LOCAL_DIR="/backup"
keys=$(cat $dir/$2.yml | yaml2json - | jq '.volumes' | jq -r 'keys[]')
files=()
for key in $keys; do
volume_name="rpc_$key"
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="https://$1.stakesquid.eu/backup/"
aria2c -d "$LOCAL_DIR" "${files[@]/#/$base_url}"

4
list-backups.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
curl -s https://$1.stakesquid.eu/backup/ | grep -oP 'rpc_[^"]*\.tar\.zst' | sort -u