| | |
| | | primary key (job_id, job_name, job_group) |
| | | ) engine=innodb auto_increment=4 comment = '宿¶ä»»å¡è°åº¦è¡¨'; |
| | | |
| | | insert into sys_job values(1, 'è½¯ä»¶ç¶ææ£æµå®æ¶ä»»å¡', 'DEFAULT', 'ryTask.runSoftTest', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); |
| | | insert into sys_job values(2, 'ç³»ç»ç¶ææ£æµå®æ¶ä»»å¡', 'DEFAULT', 'ryTask.runSubSysTest', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); |
| | | insert into sys_job values(1, 'è½¯ä»¶ç¶ææ£æµå®æ¶ä»»å¡', 'DEFAULT', 'ryTask.runSoftTest', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); |
| | | insert into sys_job values(2, 'ç³»ç»ç¶ææ£æµå®æ¶ä»»å¡', 'DEFAULT', 'ryTask.runSubSysTest', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); |
| | | -- insert into sys_job values(3, 'ç³»ç»é»è®¤ï¼å¤åï¼', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); |
| | | -- select * from sys_job order by job_id; |
| | | |
| | |
| | | */ |
| | | public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value) |
| | | { |
| | | return webFluxResponseWriter(response, HttpStatus.OK, value, R.FAIL); |
| | | return webFluxResponseWriter(response, HttpStatus.INTERNAL_SERVER_ERROR, value, R.FAIL); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysStatusCtrl; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * ç³»ç»ç¶æçæ§Mapperæ¥å£ |
| | |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public interface SysStatusCtrlMapper |
| | | { |
| | | @SuppressWarnings("ALL") |
| | | public interface SysStatusCtrlMapper { |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§ |
| | | * |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysStatusCtrlByStatusIds(Long[] statusIds); |
| | | |
| | | public int updates(@Param("list") List<SysStatusCtrl> list); |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | public void runSoftTest() throws Exception { |
| | | public void runSoftTest() { |
| | | List<SysSoft> list = getList(); |
| | | if (CollectionUtils.isEmpty(list)) return; |
| | | |
| | | // |
| | | for (SysSoft soft : list) { |
| | | //docker |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | import com.se.common.core.utils.DateUtils; |
| | | import com.se.system.domain.SysSoft; |
| | | import com.se.system.utils.CaffeineUtils; |
| | | import com.se.system.utils.ConnectUtils; |
| | | import com.se.system.utils.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.system.mapper.SysStatusCtrlMapper; |
| | | import com.se.system.domain.SysStatusCtrl; |
| | |
| | | return list; |
| | | } |
| | | |
| | | public void runSubSysTest() throws Exception { |
| | | public void runSubSysTest() { |
| | | List<SysStatusCtrl> list = getList(); |
| | | if (CollectionUtils.isEmpty(list)) return; |
| | | |
| | | // |
| | | for (SysStatusCtrl ctrl : list) { |
| | | ctrl.setStatus("0"); |
| | | ctrl.setRemark(""); |
| | | if (!StringUtils.isEmpty(ctrl.getIp()) && !ConnectUtils.isReachable(ctrl.getIp())) { |
| | | ctrl.setStatus("1"); |
| | | ctrl.setRemark("IPä¸è¿é"); |
| | | } |
| | | if (!StringUtils.isEmpty(ctrl.getUrl()) && !ConnectUtils.testUrl(ctrl.getUrl(), ctrl.getMethod())) { |
| | | ctrl.setStatus("1"); |
| | | ctrl.setRemark((ctrl.getRemark().length() > 0 ? ctrl.getRemark() + "ï¼" : "") + "URLè¿æ¥ä¸ä¸"); |
| | | } |
| | | } |
| | | |
| | | sysStatusCtrlMapper.updates(list); |
| | | } |
| | | } |
| | |
| | | package com.se.system.utils; |
| | | |
| | | import java.net.HttpURLConnection; |
| | | import java.net.InetAddress; |
| | | import java.net.URL; |
| | | import java.net.*; |
| | | |
| | | @SuppressWarnings("ALL") |
| | | public class ConnectUtils { |
| | |
| | | try { |
| | | InetAddress inetAddress = InetAddress.getByName(ip); |
| | | |
| | | return inetAddress.isReachable(1000); |
| | | return inetAddress.isReachable(1500); |
| | | } catch (Exception ex) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public static boolean getUrl(String uri, String method) { |
| | | public static boolean isReachable(String addr) { |
| | | try { |
| | | String[] strs = addr.split(":"); |
| | | InetSocketAddress socketAddress = new InetSocketAddress(strs[0], strs.length < 2 || StringUtils.isEmpty(strs[1]) ? 80 : Integer.parseInt(strs[1])); |
| | | |
| | | Socket socket = new Socket(); |
| | | socket.connect(socketAddress, 1500); |
| | | socket.close(); |
| | | |
| | | return true; |
| | | } catch (Exception ex) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public static boolean testUrl(String uri, String method) { |
| | | try { |
| | | URL url = new URL(uri); |
| | | |
| | | HttpURLConnection con = (HttpURLConnection) url.openConnection(); |
| | | con.setRequestMethod(method); |
| | | con.setRequestMethod(StringUtils.isEmpty(method) ? "GET" : method); |
| | | con.setConnectTimeout(1000); |
| | | con.setReadTimeout(1000); |
| | | |
| | |
| | | System.out.println("æ§è¡æ åæ¹æ³"); |
| | | } |
| | | |
| | | public void runSoftTest() throws Exception { |
| | | public void runSoftTest() { |
| | | System.out.println("ryTask.runSoftTest()"); |
| | | sysSoftService.runSoftTest(); |
| | | } |
| | | |
| | | public void runSubSysTest() throws Exception { |
| | | public void runSubSysTest() { |
| | | System.out.println("ryTask.runSubSysTest()"); |
| | | sysStatusCtrlService.runSubSysTest(); |
| | | } |
| | |
| | | #{statusId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update sys_status_ctrl |
| | | set status = #{item.status}, remark = #{item.remark}, update_time = now() |
| | | where status_id = #{item.statusId} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | |
| | | top -N 10 |
| | | ps -ef | grep wgcloud |
| | | kill -9 10086 |
| | | |
| | | url: jdbc:mysql://localhost:3306/se-cloud?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |