backup every 12 hours on qnap ftp

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: backup every 12 hours on qnap ftp

Post by Egregius »

This is my current backup script:

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
Procedure is that a backup is made to a folder $NOW (datestamp YYYYMMDD), after the backup a symlink is created with the name __prev. That symlink is then used as a base for the new backup resulting in a version for every day the backup has run. Each version only holds the changed files, all the rest are pure symlinks occupying almost no space.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest