use full filepath when pruning local backups

This commit is contained in:
Frederik Ring 2021-08-23 09:10:49 +02:00
parent 7086c6e645
commit f4f4fa9e74
2 changed files with 4 additions and 4 deletions

View File

@ -426,7 +426,7 @@ func (s *script) pruneOldBackups() error {
)
}
var matches []os.FileInfo
var matches []string
for _, candidate := range candidates {
fi, err := os.Stat(candidate)
if err != nil {
@ -438,14 +438,14 @@ func (s *script) pruneOldBackups() error {
}
if fi.ModTime().Before(deadline) {
matches = append(matches, fi)
matches = append(matches, candidate)
}
}
if len(matches) != 0 && len(matches) != len(candidates) {
var errors []error
for _, candidate := range matches {
if err := os.Remove(candidate.Name()); err != nil {
if err := os.Remove(candidate); err != nil {
errors = append(errors, err)
}
}

View File

@ -27,8 +27,8 @@ services:
BACKUP_CRON_EXPRESSION: 0 0 5 31 2 ?
BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-7}
BACKUP_PRUNING_LEEWAY: 5s
BACKUP_PRUNING_PREFIX: test
GPG_PASSPHRASE: 1234secret
# BACKUP_PRUNING_PREFIX: test
volumes:
- ./local:/archive
- app_data:/backup/app_data:ro