parent
88655595f1
commit
a2ee4332ac
@ -0,0 +1,27 @@
|
||||
package com.dsideal.YunXiaoTools.Cron4j;
|
||||
|
||||
import com.dsideal.YunXiaoTools.Service.MysqlRestoreService;
|
||||
import com.dsideal.YunXiaoTools.Start;
|
||||
import com.dsideal.YunXiaoTools.Utils.CommonUtil;
|
||||
import com.jfinal.plugin.cron4j.ITask;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
//0点任务
|
||||
public class YiDianTask implements ITask {
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
//写入侧
|
||||
if (Start.DEPLOY_ID == 2) {
|
||||
//获取最后一次上传的数据库文件
|
||||
String key = CommonUtil.getLastDataBaseZip();
|
||||
//还原数据库
|
||||
MysqlRestoreService mr = new MysqlRestoreService();
|
||||
int total = mr.restore(mr.jdbcUrl, mr.username, mr.password, key);
|
||||
System.out.println("恭喜,成功还原数据表:" + total + "个。");
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
// 这里的代码会在 task 被关闭前调用
|
||||
}
|
||||
}
|
Loading…
Reference in new issue