Odstraněn cesta k logu
This commit is contained in:
parent
ab8b5ff7d3
commit
1289a2c281
@ -1,22 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Zdrojová složka záloh na HD2
|
||||
BACKUP_SRC="/mnt/backup/backup"
|
||||
# Cílový adresář na Hetzner Storage Boxu
|
||||
BACKUP_DEST="u409453@u409453.your-storagebox.de:/path/to/backup"
|
||||
# Logovací soubor
|
||||
LOG_FILE="/var/log/backup_transfer.log"
|
||||
# SSH port
|
||||
SSH_PORT=23
|
||||
|
||||
# Kontrola existence logovacího souboru a jeho vytvoření, pokud neexistuje
|
||||
if [ ! -f "$LOG_FILE" ]; then
|
||||
touch "$LOG_FILE"
|
||||
chmod 644 "$LOG_FILE"
|
||||
fi
|
||||
# E-mailové adresy pro notifikace
|
||||
EMAIL="tvuj_email@example.com"
|
||||
SUBJECT="Backup Failure Notification"
|
||||
|
||||
# Synchronizace pomocí rsync
|
||||
rsync -avz -e "ssh -p $SSH_PORT" --delete "$BACKUP_SRC" "$BACKUP_DEST"
|
||||
|
||||
# Logování
|
||||
echo "Backup transfer completed on $(date)" >> "$LOG_FILE"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Backup failed" | mail -s "$SUBJECT" "$EMAIL"
|
||||
else
|
||||
echo "Backup transfer completed on $(date)"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user