Create Script Execution Tasks

<p class="shortdesc">Through task management, you can create script execution tasks. </p> <section class="section context"><div class="tasklabel"><h2 class="doc-tairway">About this task</h2></div> <p class="p" id="createscripttask__p_rng_jkr_dkb">With the script execution function, you can execute certain operations in batch, including changing the configuration of the host (such as the host name and IP address). You can manually import scripts, upload scripts from your computer or public platform, or clone existing scripts, and execute them in batch.</p> <p class="p">After the task is created, you can manage the script execution tasks. For example, you can apply them to the scheduled tasks and workflow, or you can perform the tasks for many times. </p> </section> <section id="createscripttask__steps_k3s_w43_dkb"><div class="tasklabel"><h2 class="doc-tairway">Procedure</h2></div><ol class="ol steps" id="createscripttask__steps_k3s_w43_dkb"><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">Job Management </span><abbr title="and then"> > </abbr><span class="ph uicontrol">Task Management</span></span>.</span> </li><li class="li step stepexpand"> <span class="ph cmd">On the <span class="keyword wintitle">Task Management</span> page, click <span class="ph uicontrol">Create</span> in the upper-right corner. </span> </li><li class="li step stepexpand"> <span class="ph cmd">On the <span class="keyword wintitle">Add task</span> page, select <span class="ph uicontrol">Script execution</span> as the <span class="ph uicontrol">Task Type</span>.</span> </li><li class="li step stepexpand"> <span class="ph cmd">After that, you need to complete the following configuration.</span> <div class="itemgroup info"> <img class="image" id="createscripttask__d21e70" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201407174751-1278e9659166.png"> <table class="table frame-all" id="createscripttask__d21e72"><caption></caption><colgroup><col style="width:34.01360544217687%"><col style="width:65.98639455782312%"></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="createscripttask__d21e72__entry__1">Configuration Item</th> <th class="entry" id="createscripttask__d21e72__entry__2">Description</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Task Name</span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <p class="p" id="createscripttask__d21e105">About the script execution task name.</p> </td> </tr> <tr class="row"> <td class="entry" headers="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Task Description</span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <p class="p" id="createscripttask__d21e121">About the script execution task description.</p> </td> </tr> <tr class="row"> <td class="entry" headers="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Script type</span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <p class="p" id="createscripttask__d21e137">Select the script type according to the host type: </p> <ul class="ul" id="createscripttask__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="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Target host</span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <div class="p" id="createscripttask__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="createscripttask__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="createscripttask__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="createscripttask__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="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Script source</span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <p class="p">Four methods are supported currently: </p> <ul class="ul" id="createscripttask__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="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Script content</span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <p class="p" id="createscripttask__d21e282">The specific content of the script executed on the host. </p> <div class="note note note_note" id="createscripttask__d21e285"><span class="note__title">Note:</span> The content cannot exceed 30000 characters. </div> </td> </tr> <tr class="row"> <td class="entry" headers="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Script parameter</span></p> </td> <td class="entry" headers="createscripttask__d21e72__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="createscripttask__d21e72__entry__1 "> <p class="p"><span class="ph uicontrol">Overtime </span></p> </td> <td class="entry" headers="createscripttask__d21e72__entry__2 "> <p class="p" id="createscripttask__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">Confirm Create</span>. </span> </li></ol></section>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products