Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduled backup to TFTP server

Status
Not open for further replies.

disturbedone

Vendor
Sep 28, 2006
781
AU
I'd like to schedule a backup of my Catalyst 4507 router to a TFTP server every month. I have managed to use the kron feature to do this but I'd like to add variables to the filename it stores it as.

The current config is:
Code:
kron occurrence SaveConfigSchedule at 10:21 Dec 17 recurring
 policy-list SaveConfig
!
kron occurrence Backup at 10:36 Dec 17 recurring
 policy-list Backup
!
kron policy-list SaveConfig
 cli write
!
kron policy-list Backup
 cli show run | redirect tftp://10.11.0.23/test3.cfg
Ignore the date/time as this is just for testing at the moment. It saves the running-config to startup-config using the write command and a few minutes later it copies the config to a TFTP server. This works successfully but always stores the file as test3.cfg.

Is it possible to use a variable and have the file called eg {hostname}-{date}-{time}.cfg so it doesn't overwrite the file and it is clearly identifiable when the backup is from?

I have seen the archive command used here and here but it stores the timestamp at the end of the filename and I end up with eg hostnameDec-17-11-51-32.811-0 (when the path is tftp://10.11.0.23/$h) or hostname.cfgDec-17-11-51-32.811-0 (when the path is tftp://10.11.0.23/$h.cfg).

Is there a nice way to do this and get the hostname/date/time with a proper file extension eg .cfg?
 
If you have linux, you can use RANCID to automate backups (and it will store them in subversion or cvs).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top