I have written a similar script that I use for many years now. These sort of backups are very convenient.
I started too with hard links but nowadays I prefer to format my backup disk with BTRFS and use btrfs snapshots instead, though I still support hard links.
I prefer btrfs snapshots due to their support for COW, so if I decide to play with a backup I won't mess all the other versions of this backup. With hard links you should never write to your existing backups.
Lately I added a helper script to mount remote filesystems and lock mysql databases but it could be easier to use.
Most of my code is checks to make sure I won't write somewhere I shouldn't to.
I started too with hard links but nowadays I prefer to format my backup disk with BTRFS and use btrfs snapshots instead, though I still support hard links.
I prefer btrfs snapshots due to their support for COW, so if I decide to play with a backup I won't mess all the other versions of this backup. With hard links you should never write to your existing backups.
Lately I added a helper script to mount remote filesystems and lock mysql databases but it could be easier to use.
Most of my code is checks to make sure I won't write somewhere I shouldn't to.
https://github.com/andmarios/mrbStudio