2024-07-05 05:32:17 +00:00
|
|
|
#!/bin/bash
|
2024-07-07 05:41:46 +00:00
|
|
|
|
2024-07-05 05:32:17 +00:00
|
|
|
# Zdrojová složka záloh na HD2
|
|
|
|
BACKUP_SRC="/mnt/backup/backup"
|
|
|
|
# Cílový adresář na Hetzner Storage Boxu
|
2024-07-05 18:59:33 +00:00
|
|
|
BACKUP_DEST="u409453@u409453.your-storagebox.de:/path/to/backup"
|
|
|
|
# SSH port
|
|
|
|
SSH_PORT=23
|
2024-07-07 05:41:46 +00:00
|
|
|
# E-mailové adresy pro notifikace
|
|
|
|
EMAIL="tvuj_email@example.com"
|
|
|
|
SUBJECT="Backup Failure Notification"
|
2024-07-05 05:32:17 +00:00
|
|
|
|
|
|
|
# Synchronizace pomocí rsync
|
2024-07-05 18:59:33 +00:00
|
|
|
rsync -avz -e "ssh -p $SSH_PORT" --delete "$BACKUP_SRC" "$BACKUP_DEST"
|
2024-07-07 05:41:46 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Backup failed" | mail -s "$SUBJECT" "$EMAIL"
|
|
|
|
else
|
|
|
|
echo "Backup transfer completed on $(date)"
|
|
|
|
fi
|
2024-07-05 18:59:33 +00:00
|
|
|
|