3 Commits 5dee31d6fc ... e346215be8

Author SHA1 Message Date
  wangq e346215be8 调整定时任务接口,增加一个参数,定时器ID 4 years ago
  wangq 18e59bba19 修改配置文件 4 years ago
  wangq c1600dfbb5 修改配置文件 4 years ago

+ 5 - 2
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java

@@ -115,11 +115,13 @@ public class JobInfoController {
      * @param executorParam 任务执行参数
      * @param cron          cron
      * @param author        作者
+     * @param jobGroupId    定时任务执行器ID
      * @return
      */
     //@GetMapping("/onlyoneadd")
     @RequestMapping("/onlyoneadd")
-    public ReturnT<String> onlyOneAdd(String executeName, String executorParam, String cron, String author) {
+    public ReturnT<String> onlyOneAdd(String executeName, String executorParam, String cron, String author,
+                                      int jobGroupId) {
 //        System.err.println("executorParam==" + executorParam);
 //        System.err.println("cron==" + cron);
 //        System.err.println("executeName==" + executeName);
@@ -136,7 +138,7 @@ public class JobInfoController {
 
 
         XxlJobInfo xxlJobInfo = new XxlJobInfo();
-        xxlJobInfo.setJobGroup(2);
+        xxlJobInfo.setJobGroup(jobGroupId);
         xxlJobInfo.setJobDesc(executeName);
         xxlJobInfo.setExecutorRouteStrategy("FIRST");
         xxlJobInfo.setJobCron(cron);
@@ -148,6 +150,7 @@ public class JobInfoController {
         xxlJobInfo.setGlueRemark("创建定时任务结束");
         xxlJobInfo.setExecutorTimeout(2);
         xxlJobInfo.setExecutorFailRetryCount(3);        // 失败重试次数
+        //xxlJobInfo.setAlarmEmail();
 
         ReturnT<String> addT = xxlJobService.add(xxlJobInfo);
 

+ 8 - 2
xxl-job-admin/src/main/resources/application.properties

@@ -1,5 +1,5 @@
 ### web
-server.port=8080
+server.port=9966
 #server.port=7009
 server.servlet.context-path=/xxl-job-admin
 
@@ -24,9 +24,15 @@ mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml
 #mybatis.type-aliases-package=com.xxl.job.admin.core.model
 
 ### xxl-job, datasource
+# local
 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
 spring.datasource.username=root
 spring.datasource.password=root
+# server
+#spring.datasource.url=jdbc:mysql://106.52.134.22:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+#spring.datasource.username=dever
+#spring.datasource.password=123456
+
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 
 ### datasource-pool
@@ -62,5 +68,5 @@ xxl.job.i18n=zh_CN
 xxl.job.triggerpool.fast.max=200
 xxl.job.triggerpool.slow.max=100
 
-### xxl-job, log retention days
+### xxl-job, log retention days 30
 xxl.job.logretentiondays=30

+ 1 - 1
xxl-job-admin/src/main/resources/logback.xml

@@ -2,7 +2,7 @@
 <configuration debug="false" scan="true" scanPeriod="1 seconds">
 
     <contextName>logback</contextName>
-    <property name="log.path" value="/data/applogs/xxl-job/xxl-job-admin.log"/>
+    <property name="log.path" value="/home/dever/xxl_job/xxl-job-admin.log"/>
 
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>

+ 2 - 2
xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java

@@ -33,8 +33,8 @@ public class XxlJobFileAppender {
 	 * 	---/2017-12-25/821.log
 	 *
 	 */
-	private static String logBasePath = "/data/applogs/xxl-job/jobhandler";
-	private static String glueSrcPath = logBasePath.concat("/gluesource");
+	private static String logBasePath = "/home/dever/xxl_job/jobhandler";// /home/dever/xxl_job/jobhandler
+	private static String glueSrcPath = logBasePath.concat("gluesource");
 	public static void initLogPath(String logPath){
 		// init
 		if (logPath!=null && logPath.trim().length()>0) {