Combine rsync, cp -al and rotate-backups in a single script
This script, installed on a backup server, will connect to clients using rsync, incrementally backup clients, and maintain latest backups according to a custom policy, managed by rotate-backups.
Versioned backups will share unmodified files thanks to hard links
On backup server:
- Download script
- Install requirements
- Generate an ssh key:
ssh-keygen
- Send the public ssh key to each client:
ssh-copy-id <user>@<client_name>
- Setup
config.json
- Test:
python3 rsync_rotate_backups.py
- Add to crontab e.g. a daily backup job:
20 3 * * * cd /my_user/rsync-rotate-backups && /usr/bin/python3 rsync_rotate_backups.py