Execute Scripts Immediately
<p class="shortdesc">You can choose to execute the added scripts immediately. </p>
<section><div class="tasklabel"><h2 class="doc-tairway">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
<span class="ph cmd">Log in to the <a class="xref" href="https://pinganyun.com/console/osp" target="_blank">Operation System Platform Console</a>.</span>
</li><li class="li step stepexpand">
<span class="ph cmd">In the left navigation pane, click <span class="ph menucascade"><span class="ph uicontrol">Basic Configuration</span><abbr title="and then"> > </abbr><span class="ph uicontrol">Host Instance</span></span>.</span>
</li><li class="li step stepexpand">
<span class="ph cmd">On the <span class="keyword wintitle">User Script</span> page, find the scripts to be executed and click <span class="ph uicontrol">Fast execution</span> in the <span class="ph uicontrol">Operation</span> column. </span>
</li><li class="li step stepexpand">
<span class="ph cmd">On the <span class="keyword wintitle">Fast execution</span> page, complete the following configuration.</span>
<div class="itemgroup info">
<img class="image" id="Carriescript__image_sz4_thr_bkb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201407174753-1f879f439b90.png" width="800">
<table class="table frame-all" id="Carriescript__table_aqn_vhr_bkb"><caption></caption><colgroup><col style="width:34.01360544217687%"><col style="width:65.98639455782312%"></colgroup><thead class="thead">
<tr class="row">
<th class="entry" id="Carriescript__table_aqn_vhr_bkb__entry__1">Configuration Item</th>
<th class="entry" id="Carriescript__table_aqn_vhr_bkb__entry__2">Description</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Task Name</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p" id="Carriescript__d21e105">About the script execution task name.</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Task Description</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p" id="Carriescript__d21e121">About the script execution task description.</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Script type</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p" id="Carriescript__d21e137">Select the script type according to the host type: </p>
<ul class="ul" id="Carriescript__d21e140">
<li class="li">If the host is of <strong class="ph b">Linux</strong> system, select <span class="ph uicontrol">Shell</span> as the script type. </li>
<li class="li">If the host is of <strong class="ph b">Windows</strong> system, select <span class="ph uicontrol">PowerShell</span> as the script type. </li>
</ul>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Target host</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<div class="p" id="Carriescript__d21e174">Select the hosts on which the scripts will be executed. (The corresponding OS type of Hosts will be filtered with selected scripts. Linux hosts can be chosen with Shell script, and Windows hosts can be chosen with PowerShell script). Currently, there are two methods for selecting hosts: <ul class="ul" id="Carriescript__d21e176">
<li class="li">
<p class="p"><strong class="ph b">Method One: Select Host</strong></p>
<p class="p">Click <span class="ph uicontrol">+Select host</span>. On
the <span class="keyword wintitle">Select host</span> page that
opens, tick one or more hosts, and then click
<span class="ph uicontrol">Select</span>.</p>
<img class="image" id="Carriescript__d21e196" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201407174751-14a9185093a4.png" width="500">
</li>
<li class="li">
<p class="p"><strong class="ph b">Method Two: Import Host</strong></p>
<p class="p">Click <span class="ph uicontrol">Fast Import</span>. In the <span class="ph uicontrol">Host List</span> field, enter host names or IP addresses, and then click <span class="ph uicontrol">Host match</span>. If the matches succeed, click <span class="ph uicontrol">Confirm</span>.</p>
<div class="note note note_note"><span class="note__title">Note:</span> Type in IP or Host Name, separated by comma(,), semicolon(;), vertical bar(|), or line break( ).</div>
<img class="image" id="Carriescript__d21e223" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201407174751-136848aa92e8.png" width="500">
</li>
</ul></div>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Script source</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p">Four methods are supported currently: </p>
<ul class="ul" id="Carriescript__d21e243">
<li class="li"><span class="ph uicontrol">Manual Input</span>: Write a script in the script creator.</li>
<li class="li"><span class="ph uicontrol">Local Upload</span>: According to the script type, select a script file from your computer and add the script content to the creator.<div class="note note note_note"><span class="note__title">Note:</span> The maximum size of the script file is 30K. </div></li>
<li class="li"><span class="ph uicontrol">Script Clone</span>: Select one of your scripts and add the content to the creator.</li>
<li class="li"><span class="ph uicontrol">Public Script</span>: Select one of the scripts provided by public platform and add the content to the creator.</li>
</ul>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Script content</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p" id="Carriescript__d21e282">The specific content of the script executed on the host. </p>
<div class="note note note_note" id="Carriescript__d21e285"><span class="note__title">Note:</span> The content cannot exceed 30000 characters. </div>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Script parameter</span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p">Click <span class="ph uicontrol">Execute now</span>, and then the script content will be saved as a file in the system and is executed via Powershell, CMD or Bash based on the operating system. The script parameters will be appended to the actually executed command.</p>
<p class="p">For example, suppose the script is named as <code class="ph codeph">abc.ps1</code> and is executed via Powershell, and the script parameters are <code class="ph codeph">key1=value1,key2=value2</code>, then the command finally executed in the target server is <code class="ph codeph">powershell -File abc.ps1 key1=value1 key2=value2</code>. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__1 ">
<p class="p"><span class="ph uicontrol">Overtime </span></p>
</td>
<td class="entry" headers="Carriescript__table_aqn_vhr_bkb__entry__2 ">
<p class="p" id="Carriescript__d21e332">Set up the overtime of task execution. If the process exceeds the set time, CloudAgent will end the progress. Use minute as the unit and the time range is between one minute to 30 minutes. If the setup is left blank, the overtime by default will be 30 minutes. </p>
</td>
</tr>
</tbody></table></div>
</li><li class="li step stepexpand">
<span class="ph cmd">After that, click <span class="ph uicontrol">Execute now</span>. </span>
</li></ol></section>
Did the above content solve your problem?
Yes
No
Submitted successfully! Thank you for your feedback, we will try our best to do better and better!