🐛 设置Dump数据前清空Dump文件夹
This commit is contained in:
parent
d776829009
commit
f41bd03f03
|
|
@ -140,6 +140,10 @@ public class BackupService(ILogger<BackupService> logger, IConfiguration config,
|
|||
var finalDump = $"/data/dumps/dump-{timestamp}.tar.gz";
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(dumpDir))
|
||||
{
|
||||
Directory.Delete(dumpDir, recursive: true);
|
||||
}
|
||||
Directory.CreateDirectory(dumpDir);
|
||||
|
||||
foreach (var database in databases)
|
||||
|
|
@ -185,7 +189,7 @@ public class BackupService(ILogger<BackupService> logger, IConfiguration config,
|
|||
Directory.Delete(dumpDir, recursive: true);
|
||||
_logger.LogInformation("Backup completed: {File}", finalDump);
|
||||
|
||||
await _outputService.CleanOutputDirFiles();
|
||||
_outputService.CleanOutputDirFiles();
|
||||
await _outputService.AddFileToOutput(finalDump);
|
||||
//await _cosService.AddFileToCOS(finalDump);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace SQLBackupToCOS
|
|||
throw;
|
||||
}
|
||||
}
|
||||
public async Task CleanOutputDirFiles()
|
||||
public void CleanOutputDirFiles()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue