cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3341
Views
10
Helpful
3
Replies

Delayed Switch Commands

csterry23
Level 1
Level 1

Hello all,

 

After remotely connecting to a switch such as a 3850 is there a way to send time delayed commands?

 

I know a delayed reload can be issued to a switch, but what about other commands?

 

I want to shut an interface and no shut the interface after a delay such as 2 minutes, but let's say when the interface is shut the remote connection gets broken. Is there a way to send a time delayed command such as the no shut command to reopen the interface?

 

Alternatively, could it be done through a simple script such as a python script using sleep to delay the commands?

1 Accepted Solution

Accepted Solutions

The script requires an event to launch, that is why we use a countdown timer, instead of say a syslog event.

 

As far as I know you cannot splice timers/ delays into the action steps, they complete as fast as possible. You can insert subscripts....it may not be what you have in mind!:

 

!
event manager applet noshut-interface
  event timer countdown time 300
  action 01 cli command "enable"
  action 02 cli command "config t"
  action 03 cli command "interface <your_interface>"
  action 04 cli command "no shut"
  action 05 cli command "event manager applet sub-script"
  action 06 cli command "event timer countdown time 300"
  action 07 cli command "action 1.0 cli command enable"
  action 08 cli command "action 2.0 cli config t"
  action 09 cli command "action 3.0 xxxxxxx"
  action 10 cli command "action 4.0 end"
  action 11 cli command "end"
!

There was a EEM script board on this forum, but it has now vanished. I think it has been rolled into 'network management'. There is a cisco chap @Joe Clarke who is the definition of an EEM expert who roams that board. Maybe put a follow-up post there regarding a inter-step delay.

 

cheers,

Seb.

View solution in original post

3 Replies 3

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Create an EEM script and use the a countdown timer:

 

!
event manager applet noshut-interface
  event timer countdown time 300
  action 001 cli command "enable"
  action 002 cli command "config t"
  action 003 cli command "interface <your_interface>"
  action 004 cli command "no shut"
  action 005 cli command "end"
!

...run it with the command:

event manager run noshut-interface

 

You can tweak the script so that it detects certain events prior to running, ie and interface being down/down, connectivity being lost.

 

cheers,

Seb.

Thank you the quick reply, Seb.

 

I'm assuming the event timer can be moved/added to different lines/steps in the EEM script to put pauses between commands, correct?

The script requires an event to launch, that is why we use a countdown timer, instead of say a syslog event.

 

As far as I know you cannot splice timers/ delays into the action steps, they complete as fast as possible. You can insert subscripts....it may not be what you have in mind!:

 

!
event manager applet noshut-interface
  event timer countdown time 300
  action 01 cli command "enable"
  action 02 cli command "config t"
  action 03 cli command "interface <your_interface>"
  action 04 cli command "no shut"
  action 05 cli command "event manager applet sub-script"
  action 06 cli command "event timer countdown time 300"
  action 07 cli command "action 1.0 cli command enable"
  action 08 cli command "action 2.0 cli config t"
  action 09 cli command "action 3.0 xxxxxxx"
  action 10 cli command "action 4.0 end"
  action 11 cli command "end"
!

There was a EEM script board on this forum, but it has now vanished. I think it has been rolled into 'network management'. There is a cisco chap @Joe Clarke who is the definition of an EEM expert who roams that board. Maybe put a follow-up post there regarding a inter-step delay.

 

cheers,

Seb.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card