Search in sources :

Example 1 with BackupInfoService

use of io.jpom.service.dblog.BackupInfoService in project Jpom by dromara.

the class CheckMonitor method init.

@PreLoadMethod
private static void init() {
    // 缓存检测调度
    CronUtils.upsert("cache_manger_schedule", "0 0/10 * * * ?", () -> {
        BuildUtil.reloadCacheSize();
        ConfigBean.getInstance().dataSize();
    });
    // 开启版本检测调度
    CronUtils.upsert("system_monitor", "0 0 0,12 * * ?", () -> {
        try {
            BackupInfoService backupInfoService = SpringUtil.getBean(BackupInfoService.class);
            backupInfoService.checkAutoBackup();
            // 
            RemoteVersion.loadRemoteInfo();
        } catch (Exception e) {
            DefaultSystemLog.getLog().error("系统调度执行出现错误", e);
        }
    });
    // 拉取 脚本模版日志
    CronUtils.upsert("pull_script_log", "0 0/1 * * * ?", () -> {
        NodeService nodeService = SpringUtil.getBean(NodeService.class);
        NodeScriptServer nodeScriptServer = SpringUtil.getBean(NodeScriptServer.class);
        List<String> nodeIds = nodeScriptServer.hasScriptNode();
        if (nodeIds == null) {
            return;
        }
        for (String nodeId : nodeIds) {
            NodeModel nodeModel = nodeService.getByKey(nodeId);
            if (nodeModel == null) {
                continue;
            }
            ThreadUtil.execute(() -> CheckMonitor.pullScriptLogItem(nodeModel));
        }
    });
    // 异步加载
    CheckMonitor.asyncLoad();
}
Also used : NodeModel(io.jpom.model.data.NodeModel) BackupInfoService(io.jpom.service.dblog.BackupInfoService) NodeScriptServer(io.jpom.service.node.script.NodeScriptServer) NodeService(io.jpom.service.node.NodeService) PreLoadMethod(cn.jiangzeyin.common.PreLoadMethod)

Aggregations

PreLoadMethod (cn.jiangzeyin.common.PreLoadMethod)1 NodeModel (io.jpom.model.data.NodeModel)1 BackupInfoService (io.jpom.service.dblog.BackupInfoService)1 NodeService (io.jpom.service.node.NodeService)1 NodeScriptServer (io.jpom.service.node.script.NodeScriptServer)1