作者 钟来

定时删除定时器日志记录

... ... @@ -6,6 +6,8 @@ import cn.hutool.extra.ssh.ChannelType;
import cn.hutool.extra.ssh.JschUtil;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSchException;
import com.zhonglai.luhui.dao.service.PublicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.*;
... ... @@ -15,7 +17,8 @@ import java.io.*;
*/
@Component("logTask")
public class LogTask {
@Autowired
private PublicService publicService;
/**
* mq设备服务日志采集
*/
... ... @@ -65,4 +68,12 @@ public class LogTask {
}
}
/**
* 删除定时任务日志
*/
public void deleteSysJobLog(Integer month)
{
publicService.updateBySql("DELETE FROM sys_job_log WHERE create_time < DATE_SUB(NOW(), INTERVAL "+month+" MONTH)");
}
}
... ...