|
|
@@ -1,9 +1,9 @@
|
|
|
-package cn.reghao.autodop.dmaster.backup.scheduler;
|
|
|
+package cn.reghao.autodop.dmaster.app3.scheduler;
|
|
|
|
|
|
import cn.reghao.autodop.common.shell.ShellExecutor;
|
|
|
import cn.reghao.autodop.common.shell.ShellResult;
|
|
|
import cn.reghao.autodop.common.utils.DateTimeUtil;
|
|
|
-import cn.reghao.autodop.dmaster.backup.entity.BakLog;
|
|
|
+import cn.reghao.autodop.dmaster.app3.entity.App3BakLog;
|
|
|
import cn.reghao.autodop.dmaster.common.mongo.MongoManager;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.quartz.*;
|
|
|
@@ -35,27 +35,23 @@ public class ScriptBakJob implements Job {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*MongoManager mongoManager = (MongoManager) jobDataMap.get("mongo");
|
|
|
- String script = jobDataMap.getKeys()[0];
|
|
|
- ShellExecutor executor = (ShellExecutor) jobDataMap.get(script);*/
|
|
|
-
|
|
|
- BakLog bakLog = new BakLog();
|
|
|
- bakLog.setServiceName(jobKey.getName());
|
|
|
- bakLog.setBakTime(DateTimeUtil.now());
|
|
|
+ App3BakLog app3BakLog = new App3BakLog();
|
|
|
+ app3BakLog.setApp3name(jobKey.getName());
|
|
|
+ app3BakLog.setBakTime(DateTimeUtil.now());
|
|
|
log.info("执行 {} 定时任务...", jobKey.getName());
|
|
|
try {
|
|
|
ShellResult shellResult = executor.execScript(script);
|
|
|
if (!shellResult.hasError()) {
|
|
|
- bakLog.setSuccess(true);
|
|
|
- bakLog.setResult(shellResult.getStdout());
|
|
|
+ app3BakLog.setSuccess(true);
|
|
|
+ app3BakLog.setResult(shellResult.getStdout());
|
|
|
} else {
|
|
|
- bakLog.setSuccess(false);
|
|
|
- bakLog.setResult(shellResult.getStderr());
|
|
|
+ app3BakLog.setSuccess(false);
|
|
|
+ app3BakLog.setResult(shellResult.getStderr());
|
|
|
}
|
|
|
- mongoManager.insert(bakLog);
|
|
|
+ mongoManager.insert(app3BakLog);
|
|
|
} catch (Exception e) {
|
|
|
- bakLog.setSuccess(false);
|
|
|
- bakLog.setResult(e.getMessage());
|
|
|
+ app3BakLog.setSuccess(false);
|
|
|
+ app3BakLog.setResult(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|