mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01:00
use full filepath when pruning local backups
This commit is contained in:
parent
7086c6e645
commit
f4f4fa9e74
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user