Creating Cisco MDS 9700 Switch Configuration Backup Scheduled Job
Scenario
Recently was tasked with creating a scheduled job to backup the running-config on our Cisco MDS9710 switch and TFTP it to another server. It was a great task to learn a bit about the scheduling piece in the switch and what command can be run.
Create the Job
First is to get the switch on config mode
mds-sw1# config
Next create a job called backup-cfg
mds-sw1(config)# scheduler job name backup-cfg
Now let’s start adding commands. In this case we will be creating a copy of the running-config, making a copy of it with the latest time stamp to bootflash and finally tftp it.
mds-sw1(config-job)# copy running-config startup-config
mds-sw1(config-job)# copy running-config bootflash:/$(SWITCHNAME)-cfg.$(TIMESTAMP)
mds-sw1(config-job)# copy bootflash:/$(SWITCHNAME)-cfg.$(TIMESTAMP) tftp://1.2.3.4/$(SWITCHNAME)-cfg.$(TIMESTAMP)
Note: You can run the command for the job definitions in a single line. You must have a space before the ; to separate the commands.
Example: copy running-config startup-config ;copy running-config bootflash:/$(SWITCHNAME)-cfg.$(TIMESTAMP) ;copy running-config tftp://1.2.3.4/$(SWITCHNAME)-cfg.$(TIMESTAMP)
We are done creating the job let’s exit
mds-sw1(config-job)# exit
Schedule the Job
While we are still in config mode let’s schedule the job to run at 7:00 PM and cal the schedule daily.
Create the schedule named daily.
mds-sw1(config)# scheduler schedule name daily
Associate the job called backup-cfg to it.
mds-sw1(config-schedule)# job name backup-cfg
Set the time to run at 7:00PM.
mds-sw1(config-schedule)# time daily 19:00
All done, let’s exit.
mds-sw1(config-schedule)# exit
mds-sw1(config)# exit
Validation
Let’s check our work and see if it looks good.
mds-sw1# show scheduler config
config terminal
feature scheduler
scheduler logfile size 16
end
config terminal
scheduler job name backup-cfg
copy running-config startup-config
copy running-config bootflash:/$(SWITCHNAME)-cfg.$(TIMESTAMP)
copy running-config tftp://1.2.3.4/$(SWITCHNAME)-cfg.$(TIMESTAMP)
end
config terminal
scheduler schedule name daily
time daily 19:00
job name backup-cfg
end
That’s all there is to it. So last we can wait until the job runs then the next morning run the command show scheduler logfile and it will show us any errors from the job running.
Leave a Reply