Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
9cf58564
Commit
9cf58564
authored
Sep 28, 2020
by
linlinjava
Browse files
fix
parent
04d4fc9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/job/DbJob.java
View file @
9cf58564
...
@@ -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
(
"系统结束定时任务数据库备份"
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment