×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

After Cisco Device is boot,execute some command on CLI

Unanswered Question
hobbe Sat, 06/16/2012 - 03:26
User Badges:
  • Gold, 750 points or more

Hi

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


HTH

hobbe Sat, 06/16/2012 - 04:01
User Badges:
  • Gold, 750 points or more

Hi

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 ?


HTH

hobbe Sun, 06/17/2012 - 05:46
User Badges:
  • Gold, 750 points or more

Hi


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


HTH

Joe Clarke Tue, 06/19/2012 - 08:09
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

Hi

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

Joe Clarke Tue, 06/19/2012 - 08:33
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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

https://supportforums.cisco.com/message/3657995#3657995 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.

Actions

This Discussion

Related Content