Rob's garden / notes / note

Note

Throwback to that backup system, back-it-up-back-it-in, I worked on a few months ago, today was time to start testing if my retention algorithm does what I expected it too. Unit test are one thing but I want to be sure before it starts deleting things! #Notes

The plan is to use modulo maths to keep different backups for different periods of time, relative to now.

  • a backup a day for the last 7 days (daily)
  • a backup every 7 days for 28 days (weekly)
  • a backup every 28 days for 13x28 days (monthly)
  • whatever the math is for a yearly backup

You also need a common start date so it uses the number of days since the unix epoch to keep the modulo stable for repeated runs.

There was another extra bit where it picks the earlier backup to keep it a backup isn’t available. E.g. if the backup that will eventually be the yearly backup failed it will keep the backup from the day before.

undefined

A terminal output of a list of backups to delete and remove. There are 7 backups for the last 7 days, then one every week then potentially one every month