EEM: Backup your router configuration periodically

Supposed you need to back up your router configuration at a specific time everyday, you can do this automatically using EEM.

Define EEM variables

Define the EEM variables and store the values into them.

2651-1#sh run | s event manager environment
event manager environment filename 2651-1-confg
event manager environment tftploc tftp://

Note1: Cisco has a set of predefined variables that start with “_”.

N0te2: Do not include “” quotation to the values to be stored in the variables!! I made mistakes like this:

event manager environment filename “2651-1-confg”, it did not work, the cron triggered the applet but no file was saved to tftp.

Define the action

2651-1#sh run | s event manager applet backupcfg
event manager applet backupcfg
event timer cron name job1 cron-entry “34 2 * * 0-6”
action 1.0 cli command “enable”
action 2.0 cli command “conf t”
action 3.0 cli command “file prompt quiet”
action 4.0 cli command “end”
action 5.0 cli command “copy start $tftploc$filename”
action 6.0 cli command “conf t”
action 7.0 cli command “no file prompt quiet”

The file prompt quiet command is to suppress the questions asked by IOS. If you do not suppressed the questions, they will appear despite you have already specified the location and the filename to be saved.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s