fix(backup): error path in compressed file

This commit is contained in:
Deepzz
2022-10-14 14:45:15 +08:00
committed by GitHub
parent 3b2a6689be
commit aa91997c0c

View File

@@ -44,7 +44,7 @@ func backupFromMongoDB(now time.Time) error {
}
// tar
name := fmt.Sprintf("eiblog-%s.tar.gz", now.Format("2006-01-02"))
arg = fmt.Sprintf("tar czf /tmp/%s /tmp/eiblog", name)
arg = fmt.Sprintf("tar czf /tmp/%s -C /tmp eiblog", name)
cmd = exec.CommandContext(ctx, "sh", "-c", arg)
err = cmd.Run()
if err != nil {