top | item 42986094

Python Port of 600 Line Bash Script: rsync-time-machine.py for Rsync Backups

4 points| basnijholt | 1 year ago |github.com

3 comments

order

basnijholt|1 year ago

Hi Hacker News, I'm excited to share my project, where I took on the challenge of porting a popular but untested 600+ line Bash script to Python. The outcome is rsync-time-machine.py (https://github.com/basnijholt/rsync-time-machine.py), a Python implementation of the rsync-time-backup (https://github.com/laurent22/rsync-time-backup) script. It provides Time Machine-style backups using rsync and creates incremental backups of files and directories to the destination of your choice.

The tool is designed to work on Linux, macOS, and Windows (via WSL or Cygwin). Its advantage over Time Machine is its flexibility - it can backup from/to any filesystem and works on any platform. You can also backup to a Truecrypt drive without any issues.

Unlike the original Bash script, rsync-time-machine.py is fully tested. It has no external dependencies (only requires Python ≥3.7), and it is fully compatible with rsync-time-backup (https://github.com/laurent22/rsync-time-backup). It offers pretty terminal output and is fully typed.

Key features include:

* Each backup is in its own folder named after the current timestamp.

* Backup to/from remote destinations over SSH.

* Files that haven't changed from one backup to the next are hard-linked to the previous backup, saving space.

* Safety check - the backup will only happen if the destination has explicitly been marked as a backup destination.

* Resume feature - if a backup has failed or was interrupted, the tool will resume from there on the next backup.

* Exclude file - support for pattern-based exclusion via the --exclude-from rsync parameter.

* Automatically purge old backups based on a configurable expiration strategy.

* "latest" symlink that points to the latest successful backup.

To learn more about how to use and install rsync-time-machine.py, check out the GitHub repo (https://github.com/basnijholt/rsync-time-machine.py).

I appreciate any feedback and contributions! Feel free to file an issue on the GitHub repository for any bugs, suggestions, or improvements. Looking forward to hearing your thoughts.

Happy backing up!

Please, do let me know if you have any questions or need any further information.

esaym|1 year ago

Better than rsnapshot because??

basnijholt|1 year ago

I wouldn’t say it is better, just different trade offs. Using this tool you can see/restore all files in normal folder structures without requiring the tool itself.