mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-17 03:04:46 +08:00
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)
|
outfile, err := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
defer outfile.Close()
|
return fmt.Errorf("open file %s failed, err: %v", path.Join(info.TargetDir, info.FileName), err)
|
||||||
}
|
}
|
||||||
|
defer outfile.Close()
|
||||||
dumpCmd := "mysqldump"
|
dumpCmd := "mysqldump"
|
||||||
if r.Type == constant.AppMariaDB {
|
if r.Type == constant.AppMariaDB {
|
||||||
dumpCmd = "mariadb-dump"
|
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)
|
outfile, err := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
defer outfile.Close()
|
return fmt.Errorf("open file %s failed, err: %v", path.Join(info.TargetDir, info.FileName), err)
|
||||||
}
|
}
|
||||||
|
defer outfile.Close()
|
||||||
dumpCmd := "mysqldump"
|
dumpCmd := "mysqldump"
|
||||||
if r.Type == constant.AppMariaDB {
|
if r.Type == constant.AppMariaDB {
|
||||||
dumpCmd = "mariadb-dump"
|
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)
|
outfile, err := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
defer outfile.Close()
|
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)
|
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)
|
cmd := exec.Command("docker", "exec", r.ContainerName, "pg_dump", "-F", "c", "-U", r.Username, "-d", info.Name)
|
||||||
gzipCmd := exec.Command("gzip", "-cf")
|
gzipCmd := exec.Command("gzip", "-cf")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user