Script, command to check for last run of job

Is there a command I could run against restic to check when last backup occurred, or number of snapshots since a date.

Just found that because a container was doing my backups where not running since the 13/th August. So something I could run daily to show me number of backups today, or last backup of a tag and send me a warning if there are none today.

1 Like

You can write a little script that checks the output of the snapshots command in json format

restic snapshots --json --latest 1

Or you can use a wrapper available for restic.

Many of the restic wrappers (like resticprofile ā† I made this one) can run commands after a success or a failure, and/or can send requests to third party websites like healthchecks.io so it gives you many possibilities :+1:

2 Likes

Thanks. Yeah the resticker wrapper im usi n does have an on failure command. But what Iā€™m finding if the backup container is dropping.

So itā€™s not firing commands.

I might look at health checks. Also might look at firing annotations into influxdb and using itā€™s alerting

1 Like

Other options are to scan the snapshots/ folder in your repository to see when the most recent file was created. Clearly this is depending on date+time being accurate and even if you see a new snapshot file it doesnā€™t mean that an attacker didnā€™t just change your backup set to be practically empty. But if you just want to know if restic ran and created a snapshot, it works.

Other than that, donā€™t you have logs that you can ingest somewhere to keep track of it?

1 Like

Another way is using a service like https://ifttt.com/ so I recieve a email when a new file is added on the snapshots folder.

Iā€™m just learning, so using Google Drive as repo location.

So, Iā€™m using this ā€œEmail New Google Drive Fileā€ Email New Google Drive File - IFTTT and I receive an email with the following body (And the subject that I want):

" 32b2ad4097d9a11c05405efe51d823283d530d58895372aa59c4b65a328a2f9d4

Created July 9, 2023 at 09:30AM
Folder path: /restictest/snapshots
View on Google Drive"

1 Like