From 305e360f16f1253ef67956258be7eaa3512a3bbc Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Thu, 26 Mar 2020 20:05:54 +0800 Subject: [PATCH] update batch-support.md. #1072 --- site/src/site/sphinx/batch-support.md | 14 ++++++++++---- site/src/site/sphinx/en/batch-support.md | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/site/src/site/sphinx/batch-support.md b/site/src/site/sphinx/batch-support.md index d1199537e..f4d46fc47 100644 --- a/site/src/site/sphinx/batch-support.md +++ b/site/src/site/sphinx/batch-support.md @@ -11,14 +11,14 @@ > 注意事项 > * 目前需要每个命令占一行 -> * dashboard务必开启批处理模式(`-b`),指定执行次数(`-n`),否则会导致批处理脚本无法终止 +> * dashboard务必指定执行次数(`-n`),否则会导致批处理脚本无法终止 > * watch/tt/trace/monitor/stack等命令务必指定执行次数(`-n`),否则会导致批处理脚本无法终止 > * 可以使用异步后台任务,如 `watch c.t.X test returnObj > &`,让命令一直在后台运行,通过日志获取结果,[获取更多异步任务的信息](async.md) ``` ➜ arthas git:(develop) cat /var/tmp/test.as help -dashboard -b -n 1 +dashboard -n 1 session thread sc -d org.apache.commons.lang.StringUtils @@ -26,10 +26,16 @@ sc -d org.apache.commons.lang.StringUtils #### 第二步: 运行你的批处理脚本 -通过`-b`开启批处理模式, `-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。 +通过`-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。 ```bash -./as.sh -b -f /var/tmp/test.as 56328 > test.out +./as.sh -f /var/tmp/test.as 56328 > test.out +``` + +也可以通过 `-c` 来指定指行的命令,比如 + +```bash +./as.sh -c 'sysprop; thread' 56328 > test.out ``` #### 第三步: 查看运行结果 diff --git a/site/src/site/sphinx/en/batch-support.md b/site/src/site/sphinx/en/batch-support.md index 68430721f..c2bcc4e92 100644 --- a/site/src/site/sphinx/en/batch-support.md +++ b/site/src/site/sphinx/en/batch-support.md @@ -12,7 +12,7 @@ Create a `test.as` script suffixed with `as`. Here `as` is suggested for the suf ```bash ➜ arthas git:(develop) cat /var/tmp/test.as help -dashboard -b -n 1 +dashboard -n 1 session thread sc -d org.apache.commons.lang.StringUtils @@ -20,16 +20,22 @@ sc -d org.apache.commons.lang.StringUtils Note: * Each command takes one line. -* Batch mode (via `-b`) and execution times (via `-n`) must be explicitly specified for `dashboard`, otherwise batch script cannot terminate. +* Batch mode execution times (via `-n`) must be explicitly specified for `dashboard`, otherwise batch script cannot terminate. * Commands such as `watch`/`tt`/`trace`/`monitor`/`stack` should include `-n` option to ensure the script can be able to quit. * Also consider to use `async` (for example: `watch c.t.X test returnObj > &`) to put commands run at background and get the output from the log file, see more from [asynchronous job](async.md) #### Step 2: Run the script -Use `-b` to turn on batch mode, and use `-f` to specify the script file. By default the result will be output to the standard output, but you can redirect the output to the file like this: +Use `-f` to specify the script file. By default the result will be output to the standard output, but you can redirect the output to the file like this: ```bash -./as.sh -b -f /var/tmp/test.as 56328 > test.out +./as.sh -f /var/tmp/test.as 56328 > test.out +``` + +Use `-c` also can specify the commands, like this: + +```bash +./as.sh -c 'sysprop; thread' 56328 > test.out ``` #### Step 3: Check the outputs