Hey guys and gals
I was having trouble wrapping my head around the
forget policies (restic documentation link) so I wondered what would happen to my restic repository if I do hourly backups every day for a whole year and then running my forget command on it.
Fortunately, restic has this cool feature where you can tell it make a snapshot with a pre-defined time and date value.
I wrote a bash script that does exactly that. I bet there are people out there that also wonder how their forget command with the policies will look after a year.
I wouldn’t say its the prettiest shell script but it does its job rather well and reliably.
For example I don’t even check if there is a 31.04.2017 (hint: there is none) because that would just be too much. I just pipe the error to /dev/null bc restic won’t care about that, it will just skip that try for creating a snapshot.
Some might say that you can just calculate it - well… I suck at math so I figured out a way to solve this problem for me using this script.
Attached you find some screenshots of what it looks like when you run it.
Hope this will be a help to somebody like me. If the mods/admins think this is not a good idea, feel free to remove it.