<divid="app"><!--[--><divclass="theme-container"><!--[--><headerclass="navbar"><divclass="toggle-sidebar-button"title="toggle sidebar"aria-expanded="false"role="button"tabindex="0"><divclass="icon"aria-hidden="true"><span></span><span></span><span></span></div></div><span><ahref="/en/"class=""><!----><spanclass="site-name can-hide">arthas</span></a></span><divclass="navbar-items-wrapper"style=""><!--[--><!--]--><navclass="navbar-items can-hide"><!--[--><divclass="navbar-item"><ahref="/en/"class=""aria-label="HOME"><!--[--><!--]--> HOME <!--[--><!--]--></a></div><divclass="navbar-item"><aclass="external-link"href="/doc/arthas-tutorials.html?language=en&id=arthas-basics"rel="noopener noreferrer"target="_blank"aria-label="ONLINE TUTORIALS"><!--[--><!--]--><span>ONLINE TUTORIALS</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><divclass="navbar-item"><ahref="/en/doc"class="router-link-active"aria-label="DOCS"><!--[--><!--]--> DOCS <!--[--><!--]--></a></div><divclass="navbar-item"><divclass="navbar-dropdown-wrapper"><buttonclass="navbar-dropdown-title"type="button"aria-label="SOLUTIONS"><spanclass="title">SOLUTIONS</span><spanclass="arrow down"></span></button><buttonclass="navbar-dropdown-title-mobile"type="button"aria-label="SOLUTIONS"><spanclass="title">SOLUTIONS</span><spanclass="right arrow"></span></button><ulstyle="display:none;"class="navbar-dropdown"><!--[--><liclass="navbar-dropdown-item"><aclass="external-link"href="https://cn.aliyun.com/product/aliware/mse?spm=arthas.topbar.0.0.0"rel="noopener noreferrer"target="_blank"aria-label="Microservice solutions"><!--[--><!--]--><span>Microservice solutions</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></li><liclass="navbar-dropdown-item"><aclass="external-link"href="https://www.aliyun.com/aliware/txc?spm=arthas.topbar.0.0.0"rel="noopener noreferrer"target="_blank"aria-label="Distributed transaction solutions"><!--[--><!--]--><span>Distributed transaction solutions</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></li><liclass="navbar-dropdown-item"><aclass="external-link"href="https://www.aliyun.com/product/ahas?spm=arthas.topbar.0.0.0"rel="noopener noreferrer"target="_blank"aria-label="High-availability solution"><!--[--><!--]--><span>High-availability solution</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M1
<spanclass="token builtin class-name">help</span>
dashboard -n <spanclass="token number">1</span>
session
thread
sc -d org.apache.commons.lang.StringUtils
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><p>Note:</p><ul><li>Each command takes one line.</li><li>Batch mode execution times (via <code>-n</code>) must be explicitly specified for <code>dashboard</code>, otherwise batch script cannot terminate.</li><li>Commands such as <code>watch</code>/<code>tt</code>/<code>trace</code>/<code>monitor</code>/<code>stack</code> should include <code>-n</code> option to ensure the script can be able to quit.</li><li>Also consider to use <code>async</code> (for example: <code>watch c.t.X test returnObj >&</code>) to put commands run at background and get the output from the log file, see more from <ahref="/en/doc/async.html"class="">asynchronous job</a></li></ul><h4id="step-2-run-the-script"tabindex="-1"><aclass="header-anchor"href="#step-2-run-the-script"aria-hidden="true">#</a> Step 2: Run the script</h4><p>Use <code>-f</code> 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:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>./as.sh -f /var/tmp/test.as <spanclass="token number">56328</span><spanclass="token operator">></span> test.out
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><p>Use <code>-c</code> also can specify the commands, like this:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>./as.sh -c <spanclass="token string">'sysprop; thread'</span><spanclass="token number">56328</span><spanclass="token operator">></span> test.out
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><h4id="step-3-check-the-output"tabindex="-1"><aclass="header-anchor"href="#step-3-check-the-output"aria-hidden="true">#</a> Step 3: Check the output</h4><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token function">cat</span> test.out
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div></div><!--[--><!--]--></div><footerclass="page-meta"data-v-e0e60120><divclass="meta-item edit-link"><aclass="external-link meta-item-label"href="https://github.com/alibaba/arthas/edit/master/site/docs/en/doc/batch-support.md"rel="noopener noreferrer"target="_blank"aria-label="Edit this page on GitHub"><!--[--><!--]--><span>Edit this page on GitHub</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><divclass="meta-item last-updated"><spanclass="meta-item-label">Last Updated: </span><!----></div><divclass="meta-item contributors"><spanclass="meta-item-label">Contributors: </span><spanclass="meta-item-info"><!--[--><!--[--><spanclass="contributor"title="email: hengyunabc@gmail.com">hengyunabc</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: arteevraina@gmail.com">Arteev Raina</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: LHearen@126.com">Hearen</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: ian.luo@gmail.com">beiwei30</span><!----><!--]--><!--]--></span></div></footer><navclass="page-nav"data-v-e0e60120><pclass="inner"><spanclass="prev"><ahref="/en/doc/save-log.html"class=""aria-label="Log command outputs"><!--[--><!--]--> Log command outputs <!--[--><!--]--></a></span><!----></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>