execute (Maintenance assistant task view)

Function

The execute batch-file command configures batch file execution for a maintenance assistant.

The execute command command configures command execution for a maintenance assistant.

The undo execute command cancels the configuration.

By default, no task is configured for a maintenance assistant.

Format

execute priority command command-string

execute priority batch-file file-name

undo execute priority

Parameters

Parameter Description Value
priority

Specifies the task priority.

The value is in the format of integer1[.integer2] to allow an n.5 to be inserted between n and n+1. For example, if a user has configured tasks with the priorities 2 and 3 and needs to perform a task between the tasks with the priorities 2 and 3, the user can set the priority of the new task to 2.5.

command-string

Specifies a command.

The value is a string of 1 to 511.

batch-file file-name

Specifies the name of a batch file.

The value is a string of 5 to 56 characters. The file name extension is .bat.

Views

Maintenance assistant task view

Default Level

3: Management level

Task Name and Operations

Task Name Operations
ops write

Usage Guidelines

Usage Scenario

To configure a device to automatically run a large number of commands when a specific condition is met, users can enable batch file execution for a maintenance assistant in the OPS.

After a maintenance assistant is created, the assistant must be configured with tasks. Each maintenance assistant can be configured with at most one batch file with the size not greater than 1 MB. The configuration modification in the script takes effect immediately and does not require committing.

When users configure the execute command, the OPS checks whether the file name extension is .bat but does not verify the file contents.

To configure a device to automatically run a large number of commands when a specific condition is met, users can enable batch file execution for a maintenance assistant in the OPS.

Prerequisites

The assistant command has been run in the system view to create a maintenance assistant.

The ops install file command has been run to save the batch file in the /user/bat directory.

Precautions

After a maintenance assistant is created, the assistant must be configured with tasks.

For the execute batch-file command:

  • The absolute path of the file must be specified.
  • Add the commit command in the batch file for the commands that need to be committed. Otherwise, the batch file does not take effect.
  • When users configure the execute command, the OPS checks whether the file name extension is .bat but does not verify the file contents.
  • After the execute batch-file command is run, the command execution automatically proceeds in machine-to-machine mode (Y is automatically entered). Intelligent rollback is not supported, and you must run the quit command to exit the current view before entering another view.

For the execute command command:

  • If a command must be committed, run the commit command when configuring the maintenance assistant. Otherwise, the command is not committed by default and the specified task is not performed.
  • The OPS does not provide any help information on command execution or verify configured commands.
  • After the execute command command is run, the command execution automatically proceeds in machine-to-machine mode (Y is automatically entered). Intelligent rollback is not supported, and you must run the quit command to exit the current view before entering another view.

Example

# Configure batch file execution for a maintenance assistant.
<HUAWEI> system-view
[~HUAWEI] ops
[~HUAWEI-ops] assistant task
[*HUAWEI-assistant-task] execute 2 batch-file batch.bat
# Configure the reboot command execution for a maintenance assistant.
<HUAWEI> system-view
[~HUAWEI] ops
[~HUAWEI-ops] assistant reboot
[*HUAWEI-ops-assistant-reboot] execute 1 command reboot
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >