Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Running a TCL script at router startup

Hi guys, I want to create a TCL script and have it run each time the router is started (without any user interaction). Is this possible? If so, how would I go about it?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Running a TCL script at router startup

The second applet will only run when you explicitly run it. However, it will not work as written. It should be:

event manager applet description

event none

action 1.0 cli command "enable"

action 1.1 cli command "configure terminal"

action 1.2 cli command "interface fa0/1"

action 1.3 cli command "description THIS IS A TEST"

Then you run it with:

event manager run description

5 REPLIES
Cisco Employee

Re: Running a TCL script at router startup

It's not trivial. There is a bug filed, CSCef33393, requesting that ability. The workaround is to create an EEM TCL policy using a countdown timer event detector. For example, your policy would register an event such as:

event_register_timer countdown time 10

That would run your policy 10 seconds after the router registered it (i.e. after a reload). See http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a00807c6784.html for more on writing EEM TCL policies.

Community Member

Re: Running a TCL script at router startup

Thanks for the quick reply.

I have managed to create a basic EEM (without TCL) which tracks an interface and when it goes down it reloads the router, however, I have not been able to do anything that uses the "command" function, like this:

http://ioshints.blogspot.com/2007/03/reload-eem-tcl-policy-with-eem-applet.html

For some reason when the triggered event occurs the commands are not executed. I tried a simple script e.g when an interface goes down change its description but that didn't seem to work, nor does it work when it is manually executed.

Just in case it matters I am running IOS 124-4.T7. Thanks for your help.

Example:

This works:

track 1 interface Virtual-PPP10 line-protocol

event manager applet virtual_ppp_reload

event track 1 state down

action virtual_ppp_reload reload

This does not work:

event manager applet description

event none

action 1.0 cli command "configure terminal"

action 1.1 cli command "interface fa0/1"

action 1.2 cli command "description THIS IS A TEST"

Community Member

Re: Running a TCL script at router startup

Anyone?

Cisco Employee

Re: Running a TCL script at router startup

The second applet will only run when you explicitly run it. However, it will not work as written. It should be:

event manager applet description

event none

action 1.0 cli command "enable"

action 1.1 cli command "configure terminal"

action 1.2 cli command "interface fa0/1"

action 1.3 cli command "description THIS IS A TEST"

Then you run it with:

event manager run description

Community Member

Re: Running a TCL script at router startup

ahhh, it worked perfectly, thanks for that. I thought I had tried that method too but obviously not. Thanks again.

962
Views
5
Helpful
5
Replies
CreatePlease to create content