|
@@ -25,6 +25,20 @@ public class ScriptJobHandler extends IJobHandler {
|
25
|
25
|
this.glueUpdatetime = glueUpdatetime;
|
26
|
26
|
this.gluesource = gluesource;
|
27
|
27
|
this.glueType = glueType;
|
|
28
|
+
|
|
29
|
+ // clean old script file
|
|
30
|
+ File glueSrcPath = new File(XxlJobFileAppender.getGlueSrcPath());
|
|
31
|
+ if (glueSrcPath.exists()) {
|
|
32
|
+ File[] glueSrcFileList = glueSrcPath.listFiles();
|
|
33
|
+ if (glueSrcFileList!=null && glueSrcFileList.length>0) {
|
|
34
|
+ for (File glueSrcFileItem : glueSrcFileList) {
|
|
35
|
+ if (glueSrcFileItem.getName().startsWith(String.valueOf(jobId)+"_")) {
|
|
36
|
+ glueSrcFileItem.delete();
|
|
37
|
+ }
|
|
38
|
+ }
|
|
39
|
+ }
|
|
40
|
+ }
|
|
41
|
+
|
28
|
42
|
}
|
29
|
43
|
|
30
|
44
|
public long getGlueUpdatetime() {
|
|
@@ -48,7 +62,10 @@ public class ScriptJobHandler extends IJobHandler {
|
48
|
62
|
.concat("_")
|
49
|
63
|
.concat(String.valueOf(glueUpdatetime))
|
50
|
64
|
.concat(glueType.getSuffix());
|
51
|
|
- ScriptUtil.markScriptFile(scriptFileName, gluesource);
|
|
65
|
+ File scriptFile = new File(scriptFileName);
|
|
66
|
+ if (!scriptFile.exists()) {
|
|
67
|
+ ScriptUtil.markScriptFile(scriptFileName, gluesource);
|
|
68
|
+ }
|
52
|
69
|
|
53
|
70
|
// log file
|
54
|
71
|
String logFileName = XxlJobFileAppender.contextHolder.get();
|