Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Scheduled backup to TFTP server

Scheduled backup to TFTP server

Scheduled backup to TFTP server

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:


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:// 
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://$h) or hostname.cfgDec-17-11-51-32.811-0 (when the path is tftp://$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

If you have linux, you can use RANCID to automate backups (and it will store them in subversion or cvs).

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close