Commit 9cf58564 authored by linlinjava's avatar linlinjava
Browse files

fix

parent 04d4fc9c
...@@ -38,7 +38,7 @@ public class DbJob { ...@@ -38,7 +38,7 @@ public class DbJob {
String db = url.substring(index1+5, index2); String db = url.substring(index1+5, index2);
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
String fileName = localDate.toString(); String fileName = localDate.toString() + ".sql";
File file = new File("backup", fileName); File file = new File("backup", fileName);
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
file.createNewFile(); file.createNewFile();
...@@ -47,8 +47,11 @@ public class DbJob { ...@@ -47,8 +47,11 @@ public class DbJob {
DbUtil.backup(file, user, password, db); DbUtil.backup(file, user, password, db);
// 删除七天前数据库备份文件 // 删除七天前数据库备份文件
LocalDate before = localDate.minusDays(7); LocalDate before = localDate.minusDays(7);
File fileBefore = new File("backup", fileName); String fileBeforeName = before.toString()+".sql";
fileBefore.deleteOnExit(); File fileBefore = new File("backup", fileBeforeName);
if (fileBefore.exists()) {
fileBefore.delete();
}
logger.info("系统结束定时任务数据库备份"); logger.info("系统结束定时任务数据库备份");
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment