Code: Select all
#!/bin/bash
NOW=$(date +"%Y-%m-%d")
RUNLOG=/Users/guy/BackupLogs/$NOW-nas.txt
EXCLUDED=/Users/guy/OneDrive/Backup/excludedfiles.txt
NAME="OneDrive2NAS"
echo ------------------- START $NAME -- $(date +"%Y-%m-%d %H:%M:%S") | tee -a $RUNLOG
rsync -aP --exclude-from "/Volumes/home/backup/excludedfiles.txt" --stats -e "ssh -i /Users/guy/.ssh/id_rsa -p 1598" --delete-after --link-dest="../__prev/" "/Users/guy/OneDrive/" "[email protected]:/volume1/homes/guy/OneDrive/$NOW" | tee -a $RUNLOG
ssh [email protected] "rm -f /volume1/homes/guy/OneDrive/__prev; ln -s /volume1/homes/guy/OneDrive/$NOW /volume1/homes/guy/OneDrive/__prev;"
echo ------------------- END $NAME -- $(date +"%Y-%m-%d %H:%M:%S") | tee -a $RUNLOG