diff --git a/clone-backup.sh b/clone-backup.sh index 598f4910..77277766 100755 --- a/clone-backup.sh +++ b/clone-backup.sh @@ -4,6 +4,8 @@ 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=() @@ -22,6 +24,6 @@ if [ "$3" = "--print-timestamp-only" ]; then exit 0 fi -base_url="https://$1.stakesquid.eu/backup/" +base_url="$1" aria2c -d "$LOCAL_DIR" "${files[@]/#/$base_url}" diff --git a/list-backups.sh b/list-backups.sh index a0e1a901..82ac0ef2 100755 --- a/list-backups.sh +++ b/list-backups.sh @@ -1,4 +1,3 @@ #!/bin/bash - -curl -s https://$1.stakesquid.eu/backup/ | grep -oP 'rpc_[^"]*\.tar\.zst' | sort -u +curl -s $1 | grep -oP 'rpc_[^"]*\.tar\.zst' | sort -u diff --git a/restore-volumes.sh b/restore-volumes.sh index 65060bca..d7643052 100755 --- a/restore-volumes.sh +++ b/restore-volumes.sh @@ -17,6 +17,10 @@ if [ ! -d "$volume_dir" ]; then exit 1 fi +if [[ -v $3 ]]; then + $dir/clone-backup.sh $3 $1 +fi + calculate_required_space() { # Extract the size from the filename size=$(echo "$1" | grep -oE '[0-9]+G')