Execute multiple commands at once
Sometimes you'd like to automate execution of command sequences or create a command alias that would trigger a series of commands. One way of achieving this is by creating an EEM applet. For example, to clear IP routing table and reset BGP neighbors, define the following EEM applet:
event manager applet ClearAllYou can trigger this applet with the event manager run ClearAll command or you could configure a command alias, for example alias exec cleanup event manager run ClearAll.
event none
action 1.0 cli command "clear ip route *"
action 2.0 cli command "clear ip bgp *"
Note: this article is part of You've asked for it series.
8 comments:
How can you pass a parameter?
You cannot pass a parameter when using EEM applet, you need Tcl script to do that. I'll cover that in a future post.
Please show the example with the interactive tcl script - how to pass the parameter to the command
The complete example is posted here.
ok but can you make a script with deals with such situation - sometimes when you put command you have to confirm it
like e.g reload
[confirm] ENTER
how to confirm command in the tcl script ?
I was able to figure out the reload specific solution. No luck about other prompty commands yet.
Yes reload is specific but other clear or delete commands which require confirmation are different maybe a interior variable some kind of event handler? I am still looking for this
The typeahead command worked for me in IOS release 12.4(15)T.
This blog is using JS-Kit comments. You have to enable JavaScript if you want to post a comment.