mirror of
https://github.com/alibaba/arthas.git
synced 2026-12-01 15:37:07 +00:00
as.sh/arthas-boot support width/height options. close #422
This commit is contained in:
1 parent
1cec77997f
commit
0eb32d0980
2 files changed
+60
No files matched your search
@@ -53,6 +53,11 @@ ATTACH_ONLY=false
|
|||||||
# pass debug arguments to the attach java process
|
# pass debug arguments to the attach java process
|
||||||
DEBUG_ATTACH=false
|
DEBUG_ATTACH=false
|
||||||
|
|
||||||
|
# arthas-client terminal height
|
||||||
|
HEIGHT=
|
||||||
|
# arthas-client terminal width
|
||||||
|
WIDTH=
|
||||||
|
|
||||||
# Verbose, print debug info.
|
# Verbose, print debug info.
|
||||||
VERBOSE=false
|
VERBOSE=false
|
||||||
|
|
||||||
@@ -410,6 +415,8 @@ Options and Arguments:
|
|||||||
-c,--command <value> Command to execute, multiple commands separated
|
-c,--command <value> Command to execute, multiple commands separated
|
||||||
by ;
|
by ;
|
||||||
-f,--batch-file <value> The batch file to execute
|
-f,--batch-file <value> The batch file to execute
|
||||||
|
--height <value> arthas-client terminal height
|
||||||
|
--width <value> arthas-client terminal width
|
||||||
-v,--verbose Verbose, print debug info.
|
-v,--verbose Verbose, print debug info.
|
||||||
<pid> Target pid
|
<pid> Target pid
|
||||||
|
|
||||||
@@ -537,6 +544,16 @@ parse_arguments()
|
|||||||
ARTHAS_OPTS="$JPDA_OPTS $ARTHAS_OPTS"
|
ARTHAS_OPTS="$JPDA_OPTS $ARTHAS_OPTS"
|
||||||
shift # past argument
|
shift # past argument
|
||||||
;;
|
;;
|
||||||
|
--height)
|
||||||
|
HEIGHT="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
--width)
|
||||||
|
WIDTH="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
-v|--verbose)
|
-v|--verbose)
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
shift # past argument
|
shift # past argument
|
||||||
@@ -730,11 +747,22 @@ active_console()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${BATCH_MODE}" = "true" ]; then
|
if [ "${BATCH_MODE}" = "true" ]; then
|
||||||
|
local tempArgs=()
|
||||||
|
if [ "${HEIGHT}" ]; then
|
||||||
|
tempArgs+=("--height")
|
||||||
|
tempArgs+=("${HEIGHT}")
|
||||||
|
fi
|
||||||
|
if [ "${WIDTH}" ]; then
|
||||||
|
tempArgs+=("--width")
|
||||||
|
tempArgs+=("${WIDTH}")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${COMMAND}" ] ; then
|
if [ "${COMMAND}" ] ; then
|
||||||
"${JAVA_HOME}/bin/java" ${ARTHAS_OPTS} ${JVM_OPTS} \
|
"${JAVA_HOME}/bin/java" ${ARTHAS_OPTS} ${JVM_OPTS} \
|
||||||
-jar "${arthas_lib_dir}/arthas-client.jar" \
|
-jar "${arthas_lib_dir}/arthas-client.jar" \
|
||||||
${TARGET_IP} \
|
${TARGET_IP} \
|
||||||
${TELNET_PORT} \
|
${TELNET_PORT} \
|
||||||
|
"${tempArgs[@]}" \
|
||||||
-c ${COMMAND}
|
-c ${COMMAND}
|
||||||
fi
|
fi
|
||||||
if [ "${BATCH_FILE}" ] ; then
|
if [ "${BATCH_FILE}" ] ; then
|
||||||
@@ -742,6 +770,7 @@ active_console()
|
|||||||
-jar "${arthas_lib_dir}/arthas-client.jar" \
|
-jar "${arthas_lib_dir}/arthas-client.jar" \
|
||||||
${TARGET_IP} \
|
${TARGET_IP} \
|
||||||
${TELNET_PORT} \
|
${TELNET_PORT} \
|
||||||
|
"${tempArgs[@]}" \
|
||||||
-f ${BATCH_FILE}
|
-f ${BATCH_FILE}
|
||||||
fi
|
fi
|
||||||
elif type telnet 2>&1 >> /dev/null; then
|
elif type telnet 2>&1 >> /dev/null; then
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ public class Bootstrap {
|
|||||||
*/
|
*/
|
||||||
private Long sessionTimeout;
|
private Long sessionTimeout;
|
||||||
|
|
||||||
|
private Integer height = null;
|
||||||
|
private Integer width = null;
|
||||||
|
|
||||||
private boolean verbose = false;
|
private boolean verbose = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,6 +191,18 @@ public class Bootstrap {
|
|||||||
this.batchFile = batchFile;
|
this.batchFile = batchFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Option(longName = "height")
|
||||||
|
@Description("arthas-client terminal height")
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Option(longName = "width")
|
||||||
|
@Description("arthas-client terminal width")
|
||||||
|
public void setWidth(int width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
@Option(shortName = "v", longName = "verbose", flag = true)
|
@Option(shortName = "v", longName = "verbose", flag = true)
|
||||||
@Description("Verbose, print debug info.")
|
@Description("Verbose, print debug info.")
|
||||||
public void setVerbose(boolean verbose) {
|
public void setVerbose(boolean verbose) {
|
||||||
@@ -448,6 +463,14 @@ public class Bootstrap {
|
|||||||
telnetArgs.add("-f");
|
telnetArgs.add("-f");
|
||||||
telnetArgs.add(bootstrap.getBatchFile());
|
telnetArgs.add(bootstrap.getBatchFile());
|
||||||
}
|
}
|
||||||
|
if (bootstrap.getHeight() != null) {
|
||||||
|
telnetArgs.add("--height");
|
||||||
|
telnetArgs.add("" + bootstrap.getHeight());
|
||||||
|
}
|
||||||
|
if (bootstrap.getWidth() != null) {
|
||||||
|
telnetArgs.add("--width");
|
||||||
|
telnetArgs.add("" + bootstrap.getWidth());
|
||||||
|
}
|
||||||
|
|
||||||
// telnet port ,ip
|
// telnet port ,ip
|
||||||
telnetArgs.add(bootstrap.getTargetIp());
|
telnetArgs.add(bootstrap.getTargetIp());
|
||||||
@@ -581,4 +604,12 @@ public class Bootstrap {
|
|||||||
public boolean isVersions() {
|
public boolean isVersions() {
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user