Battle tested backup scripts

Anyone have really solid battle tested backup scripts for restic?

Right now I have a script for local and remote backup as well as a maintnance script to prune while using --keep-within as well as a check script for --read-data-subset==1G.

This all works well, as far as I can tell so far.

A few things I want to solve that I do not have done.

Fail script if it is still running. This means, if my remote backup is still running, and a cron job kicks off a new one, it doesn’t have issues. I know Restic has it’s own locking, but from my quick testing, it will still try to do more than one, and won’t error gracefully. This also needs to be limited to the specific backup, like the local won’t fail if the remote is still going.

Notification of errors. Right now I am just manually kicking off the local and remote scripts every so often, so I can baby sit it while I get used to restic as well as moving stuff from my old machine to this machine and start migrating from Backblaze’s personal backup system to B2. I don’t want an email if everything goes fine, but if there is a problem, I would like to be notified. This includes some form of notification if the backup hasn’t been done in 24 hours.

Backup validation checking, right now I use the check data random 1G segment feature, but I am not sure how reliable that really is. I know some people download specific files then compare it to their current filesystem as well.

Anything else I might have missed.

Only addressing the notification part: you can use healthchecks.io. You notify it of success or failure by making a request to a URL they give you, and it will email you if you either don’t ping it in a while (by default 24h + 1h grace period, but configurable) or ping it with a failure.

Looking more for notification if something fails, not that it doesn’t run. There are lots of potential error messages that could happen.

Your backup script can check for errors and ping it with a failure, you’ll get notified either way.

Have you looked at ResticProfile or AutoRestic

Personally, I just use cronic and run restic with -v. If it runs with no errors, I get zero output (cron doesn’t email me). If it errors, I get a very detailed output from cron as to what went wrong.

For monitoring the actual repos to ensure they’ve being modified/updated I use Zabbix, which would be way overkill for your situation.

I would really suggest you look at resticprofile, it’s great.

2 Likes