cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3472
Views
10
Helpful
8
Replies

Kron with hostname

Emil Naklicki
Level 1
Level 1

Hello,

 

I have a lot of switches in need to backup. I have Kron working if I set the file name manually. For example, show run | redir tftp://10.5.7.50/folder/switch.txt. My question is, is there a way to automatically insert the hostname into this command. Something along tftp://10.5.7.50/folder/%hostname%.txt ?

1 Accepted Solution

Accepted Solutions

Hello,

 

here is an example. The $t should add a timestamp to your filename as well...

 

archive
path tftp://10.5.7.50/folder/$h-$t
write-memory

!

kron policy-list SHOWRUN
cli write memory

!

kron occurence SHOWRUN_COPY at 22:00 recurring
policy-list SHOWRUN

View solution in original post

8 Replies 8

Hello,

 

try:

 

tftp://10.5.7.50/folder/$h-

 

The '$h-' will be replaced with your hostname...

Hi George,

 

Unfortunately this is only creating a $h- file name in my tftp server.

Hello,

 

sorry about that: Try without the hyphen:

 

$h

Hello,

 

here is an example. The $t should add a timestamp to your filename as well...

 

archive
path tftp://10.5.7.50/folder/$h-$t
write-memory

!

kron policy-list SHOWRUN
cli write memory

!

kron occurence SHOWRUN_COPY at 22:00 recurring
policy-list SHOWRUN

Hello George,

So for some reason when I do this with the following, I get file name $h-$t
kron policy-list SHOWRUN
cli write memory | redir tftp://10.5.7.50/folder/$t-$t
kron occurence SHOWRUN_COPY at 22:00 recurring
policy-list SHOWRUN
Seems strange that it won't work in this fashion alone.

However,
It works great in the archive and as a bonus I get a file written every time I write memory!

Thanks again for your help. This saved me a ton of time.

Hello,

 

--> kron policy-list SHOWRUN
cli write memory | redir tftp://10.5.7.50/folder/$t-$t

 

The variable only works in the archive, not in KRON unfortunately...

Well that explains all the confusion. Thanks again.

Thanks for this, it worked for me. 

My question is, is it possible to save the configuration using archive to multiple TFTP servers at once (I have 2 tftp servers)?

 

I tried adding a second tftp path, but then that becomes the main path for saving the config.

 

Thanks!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card