swagup-server/rsync-cron/Readme-rync.md
2025-01-17 15:38:44 +01:00

2.0 KiB

Rync job for Backups

a: Archive mode used to copy files recursively while preserving symbolic links, file permissions and ownership, and timestamps. v: Verbose mode to get more detailed information on the file transfer process. z: Enable file compression. This option can be omitted when transferring files locally but is incredibly useful when sending data over the network to reduce the amount of it transmitted. H: Preserve hard links. P: Show the progress of the data transfer. --dry-run or -n - Perform a trial run without making any changes.

# create initial full backup
rsync -a --delete "/mnt/c/Users/dechert/git/swagup-server/rsync-cron/test-folder" "/mnt/c/Users/dechert/git/swagup-server/rsync-cron/backup-folder"


chmod +x /usr/local/bin/backup.sh

Testing:

  • deleted files
  • restore old backup
  • incremental
    • 234M ./test-backup-folder-time
    • du -h ~/backup_test

Rsync Time backup

https://github.com/laurent22/rsync-time-backup

bash rsync_tmbackup.sh --log-dir "/home/dechert/rsync_backup_logs" /mnt/c/Users/dechert/git/swagup-server/rsync-cron/test-folder /mnt/c/Users/dechert/git/swagup-server/rsync-cron/test-backup_folder_time

# run 1 time to create backup marker
mkdir -p -- "/mnt/c/Users/dechert/git/swagup-server/rsync-cron/test-backup_folder_time" ; touch "/mnt/c/Users/dechert/git/swagup-server/rsync-cron/test-backup_folder_time/backup.marker"

# run inside linux
bash rsync_tmbackup.sh --log-dir "/home/dechert/rsync_backup_logs" ~/backup_test/test-folder ~/backup_test/test-backup-folder-time

# Restore backup
rsync -aP ~/backup_test/test-backup-folder-time/latest ~/backup_test/test-folder --dry-run

# on synology
bash rsync_tmbackup.sh /volume2/homes/admin/marceload_backup/test-folder /volume2/homes/admin/marceload_backup/backup-folder

Logging

default log location: LOG_DIR="$HOME/.$APPNAME", e.g. /home/dechert/.rsync_tmbackup/2025-01-17-123519.log, /var/services/homes/admin/.rsync_tmbackup AUTO_DELETE_LOG -> if no error: log will be deleted