perf:数据库备份
This commit is contained in:
@@ -49,10 +49,10 @@ public class DbBackupConfig {
|
|||||||
String cmd = StrUtil.format("mysqldump -u {} --password={} --databases {} " +
|
String cmd = StrUtil.format("mysqldump -u {} --password={} --databases {} " +
|
||||||
"--compress --skip-opt --result-file {} ", username, password, dbName, saveFile);
|
"--compress --skip-opt --result-file {} ", username, password, dbName, saveFile);
|
||||||
RuntimeUtil.execForStr(cmd);
|
RuntimeUtil.execForStr(cmd);
|
||||||
RuntimeUtil.execForStr(StrUtil.format("gzip -9 {}", saveFile));
|
RuntimeUtil.execForStr(StrUtil.format("gzip -9f {}", saveFile));
|
||||||
|
|
||||||
// 删除过期备份
|
// 删除过期备份
|
||||||
RuntimeUtil.execForStr("find " + backupDir + " -mtime +" + days,
|
RuntimeUtil.execForStr("find " + backupDir + " -mtime -" + days,
|
||||||
" xargs rm -rf");
|
" xargs rm -rf");
|
||||||
|
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
|
|||||||
Reference in New Issue
Block a user