Single-file backup script which lives in the target directory alongside with data and points to actual backup storage.
Backup always simple as invoking ./backup.sh
NOTE: this is mirror-style backup, everything you have deleted in your working copy would be removed on a backup storage during sync (rsync --delete option). It's assumed your are using hard links snapshots on a backup storage if you'd like keep previous files versions.
CONTAINER is a bunch of data which you'd like to keep together, like your documents or photos.
STORAGE is a place on the backup disk/server keeping multiple containers.
By default container name is the current directory name, but you can override it by CONTAINER= option.
./backup.sh # perform backup
./backup.sh --verbose # append custom attributes to rsync
install rsync-3.1.2+
- Download from http://msys2.org/
- Follow instructions for update packman
- Install rsync and ssh
$ pacman -S rsync openssh- Create ssh key
$ ssh-keygen- Create shortcut to backup server in
.ssh/config
Host backup-server
HostName backup.srv
Port 22- Use
ssh-copy-idto copy public key to backup server
$ ssh-copy-id user@backup-server- Copy
backup-sample.shinto target folder asbackup.sh. - Open
backup.shand specify correct values forBACKUP_SERVERandSTORAGE
Examples:
BACKUP_SERVER="user@backup-server"
STORAGE="family_photos"- test in
--dry-run (-n)mode - remove
--dry-run (-n)option by commenting DEBUG= variable
- copy appropriate 32/64 version of
sh_launcher{32/64}.cmdasC:\msys{32/64}\sh_launcher.cmd - apply appropriate 32/64 version of
msys2_32_sh.reg
- Run
backup.sh - Follow instructions
Create file named backup-ignore. See backup-ignore-sample as reference.