pg_back icon indicating copy to clipboard operation
pg_back copied to clipboard

Save weekly, monthly backups

Open Krysztophe opened this issue 2 years ago • 2 comments

In addition to the N previous backups, it would be nice to keep N' weekly backups and N'' monthly backups, to be able to look back into the far past.

Krysztophe avatar Jun 24 '22 12:06 Krysztophe

Hi,

this looks interesting but quite difficult to implement because we do not have any control on how the runs are scheduled. Maybe a formulae like "keep 1 backup every N", N being 7 when scheduled daily? and so on for month

This would still have to be translate to a form easy to use in a command line option

Regards,

orgrim avatar Jun 24 '22 14:06 orgrim

I would just specify:

If present, at least a backup is kept for each of the previous purge_keep_monthly_backups months, and each of the previous purge_keep_weekly_backups weeks.

Eg, if purge_keep_monthly_backups = 2,

  • when purging, do not purge the oldest of the backups younger than 2 months
  • do not purge the oldest of the backups younger than 3 months

It can be tricky, because a 1 week old backup may be kept because of purge_older_than >7 OR purge_keep_weekly_backups >0 , and a 4 weeks old backup may be kept because purge_keep_weekly_backups > 4 OR purge_keep_monthly_backups >0.

Krysztophe avatar Jun 24 '22 15:06 Krysztophe