Home >Operation and Maintenance >Linux Operation and Maintenance >How to use CreateCommand to create a new cloud assistant command

How to use CreateCommand to create a new cloud assistant command

坏嘻嘻
坏嘻嘻Original
2018-09-27 14:01:192801browse

The content of this article is about how to use CreateCommand to create a new cloud assistant command. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

CreateCommand

Description

You can create the following types of commands:

Applicable to Windows instances Bat script (RunBatScript)

PowerShell script for Windows instances (RunPowerShellScript)

Shell script for Linux instances (RunShellScript)

You can set the timeout parameter for the command by specifying The maximum timeout when executing in an ECS instance. After the command execution times out, the Cloud Assistant client will forcibly terminate the command process, that is, cancel the PID of the command.

For a single execution, after timeout, the execution status (InvokeRecordStatus) of the command for the specified ECS instance becomes Failed.

For periodic execution:

The timeout period for periodic execution is valid for each execution record.

After an execution times out, the status of the execution record (InvokeRecordStatus) changes to Failed.

Whether the last execution timed out or not does not affect the next execution.

You can specify the execution path for the command by specifying the parameter WorkingDir. For Linux instances, the default is the home directory of the administrator root user, specifically the /root directory. For Windows instances, the default location is the directory where the Cloud Assistant client process is located, for example, C:\ProgramData\aliyun\assist\$(version).

In one region, you can create up to 100 cloud assistant commands.

Request parameters

How to use CreateCommand to create a new cloud assistant command

##Return parameters

How to use CreateCommand to create a new cloud assistant command

Example

Request Example

https://ecs.aliyuncs.com/?Action=CreateCommand
&RegionId=cn-hangzhou
&Name=Test
&Type=RunShellScript
&CommandContent=ZWNobyAxMjM=
&<公共请求参数>

Normal return example

XML format

<CreateCommandResponse>
    <RequestId>E69EF3CC-94CD-42E7-8926-F133B86387C0</RequestId>
    <CommandId>c-7d2a745b412b4601b2d47f6a768d3a14</CommandId>
</CreateCommandResponse>

JSON format

{
    "RequestId":"E69EF3CC-94CD-42E7-8926-F133B86387C0",
    "CommandId":"c-7d2a745b412b4601b2d47f6a768d3a14"
}

Exception return example

XML format

<Error>
    <RequestId>E69EF3CC-94CD-42E7-8926-F133B86387C0</RequestId>
    <HostId>ecs.aliyuncs.com</HostId>
    <Code>MissingParameter.Name</Code>
    <Message>The input parameter “Name” that is mandatory for processing this request is not supplied.</Message>
</Error>

JSON format

{
    "RequestId": "E69EF3CC-94CD-42E7-8926-F133B86387C0",
    "HostId": "ecs.aliyuncs.com"
    "Code": "MissingParameter.Name"
    "Message": "The input parameter “Name” that is mandatory for processing this request is not supplied."
}

Error code

The following are error codes unique to this interface. For more error codes, please visit the API Error Center.

How to use CreateCommand to create a new cloud assistant command

The above is the detailed content of How to use CreateCommand to create a new cloud assistant command. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn