tweaks to backup & verifydata tool to make a typical backup+verifydata produce no output

for easy use in a crontab
This commit is contained in:
Mechiel Lukkien 2023-06-01 11:34:28 +02:00
parent d25131f2f2
commit cafbfc5fdf
No known key found for this signature in database
4 changed files with 10 additions and 13 deletions

View file

@ -509,9 +509,6 @@ func backupctl(ctx context.Context, ctl *ctl) {
} }
p := srcpath[len(srcDataDir)+1:] p := srcpath[len(srcDataDir)+1:]
if p == "queue" || p == "acme" || p == "tmp" { if p == "queue" || p == "acme" || p == "tmp" {
if p == "tmp" {
xwarnx("skipping entire tmp directory", nil, mlog.Field("path", p))
}
return fs.SkipDir return fs.SkipDir
} }
l := strings.Split(p, string(filepath.Separator)) l := strings.Split(p, string(filepath.Separator))

4
doc.go
View file

@ -352,8 +352,8 @@ specifically mounts the data directory, causing attempts to hardlink outside it
to fail with an error about cross-device linking. to fail with an error about cross-device linking.
All files in the data directory that aren't recognized (i.e. other than known 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 database files, message files, an acme directory, the "tmp" directory, etc),
warning. are stored, but with a warning.
A clean successful backup does not print any output by default. Use the A clean successful backup does not print any output by default. Use the
-verbose flag for details, including timing. -verbose flag for details, including timing.

View file

@ -983,8 +983,8 @@ specifically mounts the data directory, causing attempts to hardlink outside it
to fail with an error about cross-device linking. to fail with an error about cross-device linking.
All files in the data directory that aren't recognized (i.e. other than known 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 database files, message files, an acme directory, the "tmp" directory, etc),
warning. are stored, but with a warning.
A clean successful backup does not print any output by default. Use the A clean successful backup does not print any output by default. Use the
-verbose flag for details, including timing. -verbose flag for details, including timing.

View file

@ -335,13 +335,13 @@ possibly making them potentially no longer readable by the previous version.
checkAccounts() checkAccounts()
checkOther() checkOther()
if fail {
log.Fatalf("errors were found")
} else {
log.Printf("%s: OK", dataDir)
}
if backupmoxversion != moxvar.Version { 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) 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)
}
} }