cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1527
Views
5
Helpful
2
Replies

EEM Policy that removes itself then does a 'write mem'

Richard Clayton
Level 1
Level 1

Hi

I have the following EEM Policy that I thought would remove itself then perform a 'write mem' but the policy seems to terminate at the point it removes itself from running config without the final 'write mem', I am running the below EEM version which I have read will no longer run to completion after the policy removes itself to prevent runaway policies, is there a way to achieve the final 'write mem' after policy removal, if it doesn't save to startup it will run every time the router reboots.

Thanks

Rick

 

Embedded Event Manager Version 3.20
Component Versions:
eem: (320_rel2)2.0.3

 

event manager applet crypto_key
event timer cron cron-entry "@reboot" maxrun 60
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.2 cli command "crypto key generate rsa modulus 2048"
action 1.3 cli command "interface Gi0/0"
action 1.4 cli command "no shut"
action 1.5 cli command "end"
action 1.6 cli command "write mem" pattern ".*"
action 1.7 regexp "confirm" $_cli_result
action 1.8 if $_regexp_result eq 1
action 1.9 cli command "y"
action 2.0 end
action 2.1 cli command "config t"
action 2.2 cli command "no event manager applet crypto_key"
action 2.3 cli command "end"
action 2.4 cli command "write mem"
!

1 Accepted Solution

Accepted Solutions

Newer versions of IOS do not terminate the policy when you unconfigure it.  However, if your version causes the policy to terminate, then your workaround would be fine.

View solution in original post

2 Replies 2

Richard Clayton
Level 1
Level 1

I worked around the issue with a hack, adding a second EEM applet to do the write mem with a countdown timer.

!
event manager applet write_mem
 event timer countdown time 80
 action 1.0 cli command "enable"
 action 1.1 cli command "write mem"
!

Interested to know if there is a better way though.

Rick

 

 

Newer versions of IOS do not terminate the policy when you unconfigure it.  However, if your version causes the policy to terminate, then your workaround would be fine.

Review Cisco Networking for a $25 gift card