#!/bin/bash # ------------------------------ # CONFIGURATION # ------------------------------ SRC="/media/yazoo/nextcloud_files/apex/larry" # Source directory (note trailing slash) DEST="/media/yazoo/Crucial-1T/restore_test_duplicati/files_larry" # Destination directory # Optional: Log file LOG_FILE="/var/log/rsync-backup-larry.log" # ------------------------------ # RUN SYNC # ------------------------------ echo "[$(date)] Starting rsync from $SRC to $DEST..." | tee -a "$LOG_FILE" sudo rsync -aAXv \ --delete \ "$SRC" \ "$DEST" \ 2>&1 | tee -a "$LOG_FILE" if [ $? -eq 0 ]; then echo "[$(date)] SUCCESS: Sync completed." | tee -a "$LOG_FILE" else echo "[$(date)] ERROR: Sync failed." | tee -a "$LOG_FILE" exit 1 fi