Skip to content

Instantly share code, notes, and snippets.

@Isa3v
Created November 1, 2023 06:23
Show Gist options
  • Save Isa3v/cb335c35e34eaf111eaaa0a0bc1a840f to your computer and use it in GitHub Desktop.
Save Isa3v/cb335c35e34eaf111eaaa0a0bc1a840f to your computer and use it in GitHub Desktop.

Revisions

  1. Isa3v created this gist Nov 1, 2023.
    18 changes: 18 additions & 0 deletions backup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash

    # Запрос ссылки на backup у пользователя
    read -p "Введите ссылку на backup: " backup_link

    # Скачивание файлов по ссылке, пока они существуют
    counter=1 # Счетчик для итерации по файлам
    wget -N "${backup_link}"
    while :
    do
    wget -N "${backup_link}.${counter}" || break
    ((counter++))
    done

    # Распаковка архива
    tar_files=$(basename "$backup_link")
    cat "${tar_files}"* > tmp_backup.tar.gz
    tar -xzvf tmp_backup.tar.gz