auto-execute command


[CAUTION: ]

CAUTION:

After configuring this command for a user line, you might be unable to access the CLI through the user line. Make sure you can access the CLI through a different user line before you configure this command and save the configuration.


Use auto-execute command to specify a command that is automatically executed when a user logs in through the current user line.

Use undo auto-execute command to remove the configuration.

Syntax

auto-execute command command

undo auto-execute command

Default

Command auto-execution is disabled.

Views

User line view, user line class view

Predefined user roles

network-admin

mdc-admin

Parameters

command: Specifies the command to be automatically executed.

Usage guidelines

This command is not supported in AUX line view or AUX line class view.

This command is available in both user line view and user line class view:

The device automatically executes the specified command when a user logs in through the user line, and closes the user connection after the command is executed. If the command triggers another task, the device does not close the user connection until the task is completed.

Typically, you configure the auto-execute command telnet X.X.X.X command on the device so the device redirects a Telnet user to the host at X.X.X.X. In this case, the connection to the current device is closed when the user terminates the Telnet connection to X.X.X.X.

Examples

# Configure the device to automatically Telnet to 192.168.1.41 after a user logs in through user line VTY 0.

<Sysname> system-view
[Sysname] line vty 0
[Sysname-line-vty0] auto-execute command telnet 192.168.1.41
% This action will lead to configuration failure through line-vty0. Are you sure?
[Y/N]:y
[Sysname-line-vty0]

# To verify the configuration, Telnet to 192.168.1.40.

The device automatically Telnets to 192.168.1.41, and the following output is displayed:

C:\> telnet 192.168.1.40
******************************************************************************
* Copyright (c) 2010-2017 Hewlett Packard Enterprise Development LP          *
* Without the owner's prior written consent,                                 *
* no decompiling or reverse-engineering shall be allowed.                    *
******************************************************************************
 
<Sysname>
Trying 192.168.1.41 ...
Press CTRL+K to abort
Connected to 192.168.1.41 ...
******************************************************************************
* Copyright (c) 2010-2017 Hewlett Packard Enterprise Development LP          *
* Without the owner's prior written consent,                                 *
* no decompiling or reverse-engineering shall be allowed.                    *
******************************************************************************
<Sysname.41>

This operation is the same as directly logging in to the device at 192.168.1.41 through Telnet. When you break the Telnet connection to 192.168.1.41, the Telnet connection to 192.168.1.40 is broken at the same time.