Showing results for 
Search instead for 
Did you mean: 

After Cisco Device is boot,execute some command on CLI


In other forum, introduced me EEM for my purpose.

My need is, after cisco is reloaded some command to be executed.

Is there any sample for this ?

Thanks in advance

Rising star


what type of device is it (different types of devices have different possibilities) ( ie a 3750x/1941/??)

but yes it should as a general idea be no problem to do such a thing.

Good luck



Thanks for your attention.

Our devices are Cisco Catalyst 3110x for IBM Blade-HT.

May you guide me for write such EEM for this purpose ?

Thanks in advance



I do not have access to 3110x so I do not know its capabilities, but I can try to make something for a 3750x and we can try it out to see if it works on 3110x or if we can tweak it. How does that sound ?



Thanks a lot for your attention

Because 3110 is robust in switch family with 10G interface,So I think this model has enough capabilities for my needs.

Go a head

Hall of Fame Cisco Employee

I have a whitepaper on CSC that explains how one can do this.  See:



Thanx Joseph for the syslog info.

This is what I did for testing

event manager applet test-boot

event syslog pattern "SYS-5-RESTART"

action 0 cli command "enable"

action 1 cli command "conf t"

action 2 cli command "username adamtest password juskwogruchy34"

action 3 cli command "exit"

action 4 cli command "exit"

You can add the proper commands between 2 and further on.

The event manager is version 3.20

good luck




Thanks for your reply

I have write my own EEM script.and it's work.but I want to create "delay" between every command.because in our scenario I have to up sequentially every interface.

Is there any option for this ?

Thanks in advance

Hall of Fame Cisco Employee

With EEM 3.0 and higher, you can add a "wait" action.  However, this shouldn't really be needed between each CLI command run.  Plus, the more delay you add, the more you have to keep the maxrun time in mind.  Wait actions look like:

action 3.0 wait 1

That will add a one second delay to the applet.



I have added "wait 10" after every command.unfortunately my script is run until before second "wait 10".

My script :

event syslog pattern "SYS-5-RESTART"

action 0 cli command "enable"

action 1 cli command "conf t"

action 1.1 cli command "interface range gigabitEthernet 1/0/1-8"

action 1.2 cli command "shutdown"

action 1.3 cli command "exit"

action 1.4 syslog msg "1111"

action 1.5 wait 10

action 1.6 syslog msg "2222"

action 2 cli command "interface gigabitEthernet 1/0/1"

action 2.1 cli command "no shutdown"

action 2.2 cli command "exit"

action 2.3 syslog msg "3333"

action 2.4 wait 10

action 3 cli command "interface gigabitEthernet 1/0/2"

action 3.1 cli command "no shutdown"

action 3.2 cli command "exit"

action 3.3 syslog msg "4444"

action 3.4 wait 10

action 4 cli command "interface gigabitEthernet 1/0/3"

action 4.1 cli command "no shutdown"

action 4.2 cli command "exit"

action 4.3 syslog msg "5555"

action 4.4 wait 10

action 5 cli command "interface gigabitEthernet 1/0/4"

action 5.1 cli command "no shutdown"

action 5.2 cli command "exit"

action 5.3 syslog msg "6666"

action 5.4 wait 10

action 6 cli command "interface gigabitEthernet 1/0/5"

action 6.1 cli command "no shutdown"

action 6.2 cli command "exit"

action 6.3 syslog msg "7777"

action 6.4 wait 10

action 7 cli command "interface gigabitEthernet 1/0/6"

action 7.1 cli command "no shutdown"

action 7.2 cli command "exit"

action 7.3 syslog msg "8888"

action 7.4 wait 10

action 8 cli command "interface gigabitEthernet 1/0/7"

action 8.1 cli command "no shutdown"

action 8.2 cli command "exit"

action 8.3 syslog msg "9999"

action 8.4 wait 10

action 9 cli command "interface gigabitEthernet 1/0/8"

action 9.1 cli command "no shutdown"

action 9.2 cli command "exit"

action 9.3 syslog msg "1010"

action 9.4 wait 10

action 9.5 cli command "exit"

I did not find any reason for this.

Thanks for any help or guidance

Hall of Fame Cisco Employee

Right.  As I said, you will have to be mindful of the maxrun time.  By default it is 20 seconds.  While I do not understand why you are configuring things this way, if you increase the maxrun time to 100, then the applet should run until completion.

event syslog pattern "SYS-5-RESTART" maxrun 100


I have created one discussion on and explain my problem in PAGP, unfortunately I could not find any reason for this problem,so I guess this problem is bug on cbs310x.12.2(52)-SE.after that I upgraed to 12.2(55)-SE and still I had same problem,but on this version I have EEM suuport.

In fact, using EEM is workaround for me on this issue.and I have to up every port in port-channel one by one in sequential with delay between command.

Anyhow Thanks a lot for your guidances,I think my problem has been solved.and my EEM script work as a charm.

Content for Community-Ad