< Home

Implementing a Batch Configuration Using the Commander

Context

You can make a script using either of the following methods:

  • Making a script online: Run the batch-cmd begin command to start batch online editing of commands to save them as a script. After entering the commands, press Ctrl+C to exit the editing mode. If you run this command again, the edited commands will be cleared.

    A script made online is saved in the memory of the Commander. If the Commander restarts, all the commands edited online are cleared.

  • Making a script offline: Edit commands to be executed to a batch processing file one by one. The batch processing file can be edited in .txt format. When editing the file, ensure that one command occupies one line and change the file name extension to .txt or .bat.

Command execution results are saved in the memory of clients. If the script contains commands used to clear the client memory, such as the reboot command, you cannot run the display easy-operation batch-cmd result command to check the command execution result after the commands are delivered to clients.

Pre-configuration Tasks

Before implementing a batch configuration using the Commander, complete the following tasks:

Procedure

  1. Create a group if you want to deliver commands to a group.

    1. Run system-view

      The system view is displayed.

    2. Run easy-operation

      The Easy-Operation view is displayed.

    3. Perform either of the following steps based on the group type:

      • Configure a matching rule for a built-in group.

        1. Run group build-in device-type

          A built-in group is created and the group view is displayed.

      • Configure a matching rule for a customized group.
        1. Run group custom { mac-address | esn | ip-address | model | device-type} group-name

          A customized group is created and the group view is displayed.

        2. Run match { mac-address mac-address [ mac-mask | mac-mask-length ] | esn esn | ip-address ip-address [ ip-mask | ip-mask-length ] | model model | device-type device-type }

          A matching rule is defined for the customized group.

  2. Edit commands and save them as a script.

    • Make a script online.

      1. Run system-view

        The system view is displayed.

      2. Run easy-operation

        The Easy-Operation view is displayed.

      3. Run batch-cmd begin

        The batch command editing mode is started.

        • Only one network administrator is allowed to edit commands online at one time.
        • If no operation is performed in the batch command editing mode within 30 seconds, the system automatically exits from the editing mode displays the Easy-Operation view. The complied commands are saved in the script.

      4. Edit commands in the script.

        • The maximum length of a command (including the incomplete command) to be entered is 510 characters. If the command contains more than 510 characters, it cannot be saved in the script.

        • A script can contain a maximum of 200 commands.

        • After you enter a command, press Enter to confirm the input. Then, you cannot modify the inputted command.

      5. Press Ctrl+C to exit the batch command editing mode.

    • Make a script offline.

      To make a script offline, add commands to be executed to a batch processing file one by one. The batch processing file can be edited in .txt format. Save it in the *.txt or *.bat format and upload the script file to the root directory of the Commander.

    • Scripts cannot contain Chinese characters.
    • For security purposes, scripts made offline should not contain password information.
    • If a large number of commands need to be configured, you are advised to make a script offline. If you want to make a script online, ensure that the entered information is correct because the entered information cannot be modified or viewed. Therefore, if you enter an incorrect value, you can only exit and enter the editing mode again.

  3. Deliver commands.

    • Run execute [ script-file ] to client { client-id1 [ to client-id2 ] }&<1–10>

      Commands are delivered to a specified client.

    • Run execute [ script-file ] to client all

      Commands are delivered to all clients.

    • Run execute [ script-file ] to group { name group-name }&<1–10>

      Commands are delivered to a specified group.

    • Run execute [ script-file ] to group all

      Commands are delivered to all groups.

    If script-file is not specified, the Commander delivers a script made online. If script-file is specified, the Commander delivers a specific script made offline.

Verifying the Configuration

  • Run the display easy-operation batch-cmd result command to check the command execution results.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >