update as.sh to support --versions

This commit is contained in:
hengyunabc committed 2018-09-19 19:31:12 +08:00
1 parent 6d8ebeea23
commit 280fac704c
2 files changed
+32 -2

No files matched your search

+15 -1
View File
@@ -204,6 +204,7 @@ Usage:
[-f] : specify the path to batch script file.
[--attach-only] : only attach the arthas agent to target jvm.
[--use-version] : use the specified arthas version to attach.
[--versions] : list all arthas versions.
Example:
./as.sh <PID>
@@ -213,7 +214,8 @@ Example:
./as.sh -b <PID>
./as.sh -b -f /path/to/script
./as.sh --attach-only <PID>
./as.sh --use-version 2.0.20161221142407 <PID>
./as.sh --use-version 3.0.5.20180919185025 <PID>
./as.sh --versions
Here is the list of possible java process(es) to attatch:
@@ -221,6 +223,13 @@ $(${JAVA_HOME}/bin/jps -l | grep -v sun.tools.jps.Jps)
"
}
# list arthas versions
list_versions()
{
echo "Arthas versions under ${ARTHAS_LIB_DIR}:"
ls -1 ${ARTHAS_LIB_DIR}
}
# parse the argument
parse_arguments()
{
@@ -229,6 +238,11 @@ parse_arguments()
exit 0
fi
if ([ "$1" = "--versions" ]) ; then
list_versions
exit 0
fi
if [ "$1" = "-b" ]; then
BATCH_MODE=true
shift