update doc

This commit is contained in:
hengyunabc committed 2020-08-13 17:40:43 +08:00
1 parent 30b2a190c6
commit da5f4a397d
35 files changed
+417 -45

No files matched your search

+40 -6
View File
@@ -126,7 +126,8 @@
<li class="toctree-l3"><a class="reference internal" href="#enhancer">enhancer</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#others">Others</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#cases">Cases</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#get-classpath-of-java-application">Get classpath of Java application</a></li>
<li class="toctree-l3"><a class="reference internal" href="#make-watch-command-output-a-map-object">Make watch command output a map object</a></li>
</ul>
</li>
@@ -229,9 +230,9 @@ http api.</p>
<h3>Request data format<a class="headerlink" href="#request-data-format" title="Permalink to this headline"></a></h3>
<div class="highlight-json notranslate"><div class="highlight hljs"><pre class="json">{
&quot;action&quot;: &quot;exec&quot;,
&quot;requestId&quot;: &quot;req112&quot;
&quot;sessionId&quot;: &quot;94766d3c-8b39-42d3-8596-98aee3ccbefb&quot;
&quot;consumerId&quot;: &quot;955dbd1325334a84972b0f3ac19de4f7_2&quot;
&quot;requestId&quot;: &quot;req112&quot;,
&quot;sessionId&quot;: &quot;94766d3c-8b39-42d3-8596-98aee3ccbefb&quot;,
&quot;consumerId&quot;: &quot;955dbd1325334a84972b0f3ac19de4f7_2&quot;,
&quot;command&quot;: &quot;version&quot;,
&quot;execTimeout&quot;: &quot;10000&quot;
}</pre></div>
@@ -754,9 +755,42 @@ receive this <code class="docutils literal notranslate"><span class="pre">enhanc
prompt the user according to the result of <code class="docutils literal notranslate"><span class="pre">enhancer</span></code>.</p>
</div>
</div>
<div class="section" id="others">
<h2>Others<a class="headerlink" href="#others" title="Permalink to this headline"></a></h2>
<div class="section" id="cases">
<h2>Cases<a class="headerlink" href="#cases" title="Permalink to this headline"></a></h2>
<div class="section" id="get-classpath-of-java-application">
<h3>Get classpath of Java application<a class="headerlink" href="#get-classpath-of-java-application" title="Permalink to this headline"></a></h3>
<p>Get system properties of the Java application through Http api and
extract the value of <code class="docutils literal notranslate"><span class="pre">java.class.path</span></code>.</p>
<div class="highlight-bash notranslate"><div class="highlight hljs"><pre class="bash">json_data=$(curl -Ss -XPOST http://localhost:8563/api -d &#x27;
{
&quot;action&quot;:&quot;exec&quot;,
&quot;command&quot;:&quot;sysprop&quot;
}&#x27;)</pre></div>
</div>
<ul class="simple">
<li><p>Extract value with <code class="docutils literal notranslate"><span class="pre">sed</span></code>:</p></li>
</ul>
<div class="highlight-bash notranslate"><div class="highlight hljs"><pre class="bash">class_path=$(echo $json_data | tr -d &#x27;\n&#x27; | sed &#x27;s/.*&quot;java.class.path&quot;:&quot;\([^&quot;]*\).*/\1/&#x27;)
echo &quot;classpath: $class_path&quot;</pre></div>
</div>
<ul class="simple">
<li><p>Extract value with <code class="docutils literal notranslate"><span class="pre">json_pp/awk</span></code>:</p></li>
</ul>
<div class="highlight-bash notranslate"><div class="highlight hljs"><pre class="bash">class_path=$(echo $json_data | tr -d &#x27;\n&#x27; | json_pp | grep java.class.path | awk -F&#x27;&quot;&#x27; &#x27;{ print $4 }&#x27;)
echo &quot;classpath: $class_path&quot;</pre></div>
</div>
<p>Output:</p>
<div class="highlight-default notranslate"><pre class="literal-block">classpath: demo-arthas-spring-boot.jar</pre>
</div>
<p>NOTE:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">echo</span> <span class="pre">$json_data</span> <span class="pre">|</span> <span class="pre">tr</span> <span class="pre">-d</span> <span class="pre">'\n'</span></code> : Delete line breaks (the value of
<code class="docutils literal notranslate"><span class="pre">line.separator</span></code>) to avoid affecting the processing of <code class="docutils literal notranslate"><span class="pre">sed</span></code>/<code class="docutils literal notranslate"><span class="pre">json_pp</span></code>
commands.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">awk</span> <span class="pre">-F'&quot;'</span> <span class="pre">'{</span> <span class="pre">print</span> <span class="pre">$4</span> <span class="pre">}'</span></code> : Use double quote as delimiter</p></li>
</ul>
<p><a id="change_watch_value_to_map"></a></p>
</div>
<div class="section" id="make-watch-command-output-a-map-object">
<h3>Make watch command output a map object<a class="headerlink" href="#make-watch-command-output-a-map-object" title="Permalink to this headline"></a></h3>
<p>The result value of <code class="docutils literal notranslate"><span class="pre">watch</span></code> is generated by calculating the