Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b7935a93
authored
Apr 27, 2017
by
xueli.xue
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
shell脚本"\r"问题fix
parent
b30fceb4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java
xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
View file @
b7935a93
...
@@ -89,6 +89,11 @@ public class XxlJobServiceImpl implements IXxlJobService {
...
@@ -89,6 +89,11 @@ public class XxlJobServiceImpl implements IXxlJobService {
return
new
ReturnT
<
String
>(
500
,
"请输入“JobHandler”"
);
return
new
ReturnT
<
String
>(
500
,
"请输入“JobHandler”"
);
}
}
// fix "\r" in shell
if
(
GlueTypeEnum
.
GLUE_SHELL
==
GlueTypeEnum
.
match
(
jobInfo
.
getGlueType
())
&&
jobInfo
.
getGlueSource
()!=
null
)
{
jobInfo
.
setGlueSource
(
jobInfo
.
getGlueSource
().
replaceAll
(
"\r"
,
""
));
}
// childJobKey valid
// childJobKey valid
if
(
StringUtils
.
isNotBlank
(
jobInfo
.
getChildJobKey
()))
{
if
(
StringUtils
.
isNotBlank
(
jobInfo
.
getChildJobKey
()))
{
String
[]
childJobKeys
=
jobInfo
.
getChildJobKey
().
split
(
","
);
String
[]
childJobKeys
=
jobInfo
.
getChildJobKey
().
split
(
","
);
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
View file @
b7935a93
...
@@ -208,19 +208,21 @@ exit 0
...
@@ -208,19 +208,21 @@ exit 0
<textarea
class=
"glueSource_python"
style=
"display:none;"
>
<textarea
class=
"glueSource_python"
style=
"display:none;"
>
#!/usr/bin/python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
import logging
import time
import time
import sys
logging.basicConfig(level=logging.DEBUG)
print "xxl-job: hello python"
print "脚本文件:", sys.argv[0]
logging.info('xxl-job: hello python')
for i in range(1, len(sys.argv)):
for num in range(1, 3):
time.sleep(1)
time.sleep(1)
logging.info('python :' + str(num) )
print "参数", i, sys.argv[i]
logging.info('Good bye!')
print "Good bye!"
exit(0)
<
#
--
import
logging
logging
.
basicConfig
(
level=
logging.DEBUG)
logging
.
info
("脚本文件:"
+
sys
.
argv
[
0
])
--
>
</textarea>
</textarea>
</form>
</form>
...
...
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java
View file @
b7935a93
...
@@ -88,7 +88,7 @@ public class JobThread extends Thread{
...
@@ -88,7 +88,7 @@ public class JobThread extends Thread{
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
toStop
)
{
if
(
toStop
)
{
logger
.
error
(
"----------- xxl-job toStop, stopReason:{}"
,
stopReason
);
logger
.
error
(
"
<br>
----------- xxl-job toStop, stopReason:{}"
,
stopReason
);
}
}
logger
.
error
(
"JobThread Exception:"
,
e
);
logger
.
error
(
"JobThread Exception:"
,
e
);
StringWriter
out
=
new
StringWriter
();
StringWriter
out
=
new
StringWriter
();
...
@@ -111,7 +111,7 @@ public class JobThread extends Thread{
...
@@ -111,7 +111,7 @@ public class JobThread extends Thread{
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
toStop
)
{
if
(
toStop
)
{
logger
.
error
(
"----------- xxl-job toStop, stopReason:{}"
,
stopReason
);
logger
.
error
(
"
<br>
----------- xxl-job toStop, stopReason:{}"
,
stopReason
);
}
}
logger
.
error
(
"----------- xxl-job JobThread Exception:"
,
e
);
logger
.
error
(
"----------- xxl-job JobThread Exception:"
,
e
);
}
}
...
...
xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java
View file @
b7935a93
...
@@ -87,7 +87,7 @@ public class ScriptUtil {
...
@@ -87,7 +87,7 @@ public class ScriptUtil {
DefaultExecutor
exec
=
new
DefaultExecutor
();
DefaultExecutor
exec
=
new
DefaultExecutor
();
exec
.
setExitValues
(
null
);
exec
.
setExitValues
(
null
);
exec
.
setStreamHandler
(
streamHandler
);
exec
.
setStreamHandler
(
streamHandler
);
int
exitValue
=
exec
.
execute
(
commandline
);
// exit code: 0=success, 1
/-1=fail
int
exitValue
=
exec
.
execute
(
commandline
);
// exit code: 0=success, 1
=error
return
exitValue
;
return
exitValue
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment