From b170509905e2d57c44f8b28e7da84bfd4989ffd4 Mon Sep 17 00:00:00 2001 From: archos Date: Fri, 5 Jul 2024 07:15:37 +0200 Subject: [PATCH] =?UTF-8?q?p=C5=99=C3=ADd=C3=A1n=20skript,=20pro=20automat?= =?UTF-8?q?ick=C3=A9=20z=C3=A1lohy=20Oscloud/Hetzner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/backup_to_hetzner.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/backup_to_hetzner.sh diff --git a/scripts/backup_to_hetzner.sh b/scripts/backup_to_hetzner.sh new file mode 100644 index 0000000..79cbd26 --- /dev/null +++ b/scripts/backup_to_hetzner.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Zdrojová složka záloh na HD2 +BACKUP_SRC="/mnt/backup/backup" +# Cílový adresář na Hetzner Storage Boxu +BACKUP_DEST="user@storagebox.hetzner.com:/path/to/backup" +# Logovací soubor +LOG_FILE="/var/log/backup_transfer.log" + +# Kontrola existence logovacího souboru a jeho vytvoření, pokud neexistuje +if [ ! -f "$LOG_FILE" ]; then + touch "$LOG_FILE" + chmod 644 "$LOG_FILE" +fi + +# Synchronizace pomocí rsync +rsync -avz --delete "$BACKUP_SRC" "$BACKUP_DEST" + +# Logování +echo "Backup transfer completed on $(date)" >> "$LOG_FILE"