From cafbfc5fdf129c348d4ed9fb5c62018bade977ee Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Thu, 1 Jun 2023 11:34:28 +0200 Subject: [PATCH] tweaks to backup & verifydata tool to make a typical backup+verifydata produce no output for easy use in a crontab --- backup.go | 3 --- doc.go | 4 ++-- main.go | 4 ++-- verifydata.go | 12 ++++++------ 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/backup.go b/backup.go index 3e68880..d3e7c20 100644 --- a/backup.go +++ b/backup.go @@ -509,9 +509,6 @@ func backupctl(ctx context.Context, ctl *ctl) { } p := srcpath[len(srcDataDir)+1:] if p == "queue" || p == "acme" || p == "tmp" { - if p == "tmp" { - xwarnx("skipping entire tmp directory", nil, mlog.Field("path", p)) - } return fs.SkipDir } l := strings.Split(p, string(filepath.Separator)) diff --git a/doc.go b/doc.go index 0dc36d3..2ee1bbe 100644 --- a/doc.go +++ b/doc.go @@ -352,8 +352,8 @@ specifically mounts the data directory, causing attempts to hardlink outside it to fail with an error about cross-device linking. All files in the data directory that aren't recognized (i.e. other than known -database files, message files, an acme directory, etc), are stored, but with a -warning. +database files, message files, an acme directory, the "tmp" directory, etc), +are stored, but with a warning. A clean successful backup does not print any output by default. Use the -verbose flag for details, including timing. diff --git a/main.go b/main.go index 8bb8251..3aeb269 100644 --- a/main.go +++ b/main.go @@ -983,8 +983,8 @@ specifically mounts the data directory, causing attempts to hardlink outside it to fail with an error about cross-device linking. All files in the data directory that aren't recognized (i.e. other than known -database files, message files, an acme directory, etc), are stored, but with a -warning. +database files, message files, an acme directory, the "tmp" directory, etc), +are stored, but with a warning. A clean successful backup does not print any output by default. Use the -verbose flag for details, including timing. diff --git a/verifydata.go b/verifydata.go index a51a732..c57e23b 100644 --- a/verifydata.go +++ b/verifydata.go @@ -335,13 +335,13 @@ possibly making them potentially no longer readable by the previous version. checkAccounts() checkOther() - if fail { - log.Fatalf("errors were found") - } else { - log.Printf("%s: OK", dataDir) - } - if backupmoxversion != moxvar.Version { log.Printf("NOTE: The backup was made with mox version %q, while verifydata was run with mox version %q. Database files have probably been modified by running mox verifydata. Make a fresh backup before upgrading.", backupmoxversion, moxvar.Version) } + + if fail { + log.Fatalf("errors were found") + } else { + fmt.Printf("%s: OK\n", dataDir) + } }