×

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.

How do I automatically save running config onto startup config?

Unanswered Question
Apr 28th, 2014
User Badges:

When I configure onto a router, the configurations are stored in running configuration and it requires for me to run "wr" command to store running configurations onto startup configuration.  Thus, this enables the configurations to be retained even after router restart.

Is there any mechanism, wherein any configuration that I do on the router, should by default be written onto startup configuration, without me explicitly invoking the "wr" command every time.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
tanvsult Mon, 04/28/2014 - 23:55
User Badges:

Hi msgforsunil,

you have several ways of saving your config on the tftp server on a timely basis. You ask if for saving the config everytime you run a command on the router.

kindly run the following clis on the router to have this executed:

 

conf t

event manager applet MANAGEWRITE
 event cli pattern ".*" sync no skip no
 action 1.0 cli command "wr mem"
 action 2.0 cli command "do wr mem"
 action 3.0 cli command "enable"
 action 4.0 cli command "wr mem"

The term MANAGEWRITE here highlighted in GREEN is just a name. You can name it whatever you wish.

Hope this answers your query. Let me know if you have any doubts....

 

Thanks,,,

 

 

 

Sunil Kumar Tue, 04/29/2014 - 22:10
User Badges:

Hi tanvsult

This seems to slow down the performance of the router. Any other better alternative?

Thank you.

tanvsult Tue, 04/29/2014 - 23:34
User Badges:

Hi,

The whole idea of not doing a write automatically is to make sure that changes that might cause issues to the working condition of the router can be avoided and in the worst case when they reload the router, it should come up with the good old config that was available in the start-up config.

In your case you wanted every line of config to be written in the startup, which is not a good idea.

What you can do is, you can do a periodical write on the tftp server. This could be every day or every week.

Thanks,

 

 

 

Sunil Kumar Wed, 04/30/2014 - 02:49
User Badges:

Could the write be scheduled, say once in 5 hours or so, the running config to be copied to startup config?  If yes, can you please share the updated solution?

Thank you.

tanvsult Wed, 04/30/2014 - 09:01
User Badges:

Hi,

As mentioned, there are several ways to do a periodic backup. You have commands that range from two lines to several lines. I use the following to do a write mem every 6 hours daily.

 

kron occurrence daily1 at 00:00 recurring
 policy-list save-config
kron occurrence daily2 at 06:00 recurring
 policy-list save-config
kron occurrence daily3 at 12:00 recurring
 policy-list save-config
kron occurrence daily4  at 18:00 recurring
 policy-list save-config

kron policy-list save-config
 cli write memory

 

 

If you want to do a write mem every one hour, You can use the following commands

 

event manager applet WR_Conf
 event timer cron name WR_Conf cron-entry " 25 * * * *"
 action 1.0 cli command "enable"
 action 1.1 cli command "wr"
 action 1.2 syslog msg "Config has been saved by EEM script"

Thanks,

 

 

tanvsult Thu, 05/01/2014 - 01:19
User Badges:

DO not worry about the number 25 in the entry " event timer cron name WR_Conf cron-entry " 25 * * * *" "

 

This can be anything between 0 and 59. it will repeat it every 60 minutes as the clock strikes the same number in the minutes field every 60 minutes.

 

Actions

This Discussion