1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-11-29 05:46:50 +02:00

fix location of success message for having created local backup

This commit is contained in:
Frederik Ring
2021-08-22 20:42:25 +02:00
parent 935de92f2e
commit 7244725c5b
2 changed files with 7 additions and 8 deletions

View File

@@ -41,6 +41,7 @@ func main() {
s.must(s.copyBackup())
s.must(s.cleanBackup())
s.must(s.pruneOldBackups())
s.logger.Info("Finished running backup tasks.")
}
type script struct {
@@ -305,11 +306,9 @@ func (s *script) copyBackup() error {
s.logger.Infof("Successfully uploaded a copy of backup `%s` to bucket `%s`", s.file, s.bucket)
}
if s.archive != "" {
if _, err := os.Stat(s.archive); !os.IsNotExist(err) {
if err := copy(s.file, path.Join(s.archive, name)); err != nil {
return fmt.Errorf("copyBackup: error copying file to local archive: %w", err)
}
if _, err := os.Stat(s.archive); !os.IsNotExist(err) {
if err := copy(s.file, path.Join(s.archive, name)); err != nil {
return fmt.Errorf("copyBackup: error copying file to local archive: %w", err)
}
s.logger.Infof("Successfully stored copy of backup `%s` in local archive `%s`", s.file, s.archive)
}
@@ -404,7 +403,7 @@ func (s *script) pruneOldBackups() error {
}
}
if s.archive != "" {
if _, err := os.Stat(s.archive); !os.IsNotExist(err) {
candidates, err := filepath.Glob(
path.Join(s.archive, fmt.Sprintf("%s*", os.Getenv("BACKUP_PRUNING_PREFIX"))),
)