Scheduled backup to TFTP server
Scheduled backup to TFTP server
(OP)
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:
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?
The current config is:
CODE --> IOS
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
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?
RE: Scheduled backup to TFTP server