mirror of https://github.com/1Panel-dev/1Panel
parent
99ed9be1dd
commit
9c357f1ea4
|
@ -225,9 +225,10 @@ func (r *Local) Backup(info BackupInfo) error {
|
|||
}
|
||||
}
|
||||
outfile, err := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
|
||||
if err == nil {
|
||||
defer outfile.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("open file %s failed, err: %v", path.Join(info.TargetDir, info.FileName), err)
|
||||
}
|
||||
defer outfile.Close()
|
||||
dumpCmd := "mysqldump"
|
||||
if r.Type == constant.AppMariaDB {
|
||||
dumpCmd = "mariadb-dump"
|
||||
|
|
|
@ -236,9 +236,10 @@ func (r *Remote) Backup(info BackupInfo) error {
|
|||
}
|
||||
}
|
||||
outfile, err := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
|
||||
if err == nil {
|
||||
defer outfile.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("open file %s failed, err: %v", path.Join(info.TargetDir, info.FileName), err)
|
||||
}
|
||||
defer outfile.Close()
|
||||
dumpCmd := "mysqldump"
|
||||
if r.Type == constant.AppMariaDB {
|
||||
dumpCmd = "mariadb-dump"
|
||||
|
|
|
@ -130,9 +130,10 @@ func (r *Local) Backup(info BackupInfo) error {
|
|||
}
|
||||
}
|
||||
outfile, err := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
|
||||
if err == nil {
|
||||
defer outfile.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("open file %s failed, err: %v", path.Join(info.TargetDir, info.FileName), err)
|
||||
}
|
||||
defer outfile.Close()
|
||||
global.LOG.Infof("start to pg_dump | gzip > %s.gzip", info.TargetDir+"/"+info.FileName)
|
||||
cmd := exec.Command("docker", "exec", r.ContainerName, "pg_dump", "-F", "c", "-U", r.Username, "-d", info.Name)
|
||||
gzipCmd := exec.Command("gzip", "-cf")
|
||||
|
|
Loading…
Reference in New Issue