cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5790
Views
0
Helpful
18
Replies

Catalyst Kron Daily Backup Timestamp

Paul Bedorf
Level 1
Level 1

I have the following kron backup set on my Catalyst 3850 switch:

kron occurrence daily-backup at 1:00 recurring
 policy-list dail-backup
!
kron policy-list daily-backup
 cli show run | redirect ftp://192.168.96.65/3850Stack-config-$(TIMESTAMP).cfg

But when this runs the file on the ftp server is saved like this:
3850Stack-config-$(TIMESTAMP).cfg

The $(TIMESTAMP) variable does not seem to get picked up.... i have identical configuration set up on my Cisco Nexus 3K switches and this works fine....

Is it possible to use variables in Cisco Catalyst IOS?

2 Accepted Solutions

Accepted Solutions

balaji.bandi
Hall of Fame
Hall of Fame

You can use example as below.:

 

rchive
path tftp://IP_of_TFTP_SERVER/$h__$t       ( here is hostname and Time stamp)
write-memory

 

 

kron occurrence daily-config-backup at 0:05 recurring  
policy-list backup-config
!
kron policy-list backup-config
cli write memory
!

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

View solution in original post

You are right, some how its not redirecting as expected on 3750 when i did test last night,

 

Can you use EEM script, does the same function what you looking

 

Note : i will do some test later and get back to you.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

View solution in original post

18 Replies 18

balaji.bandi
Hall of Fame
Hall of Fame

You can use example as below.:

 

rchive
path tftp://IP_of_TFTP_SERVER/$h__$t       ( here is hostname and Time stamp)
write-memory

 

 

kron occurrence daily-config-backup at 0:05 recurring  
policy-list backup-config
!
kron policy-list backup-config
cli write memory
!

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hi, I have switch 3750 but in my backup kron $h__$t does not work. Please help me with this problem?

 

Hello,

 

post the backup configuration you have. What output do you get ?

Hi, This is my config kron backup method to FTP, and I need add date to krome, because new backup rewrite old backup

in destination pat.

kron occurrence FTP_Config_Backup at 22:00 recurring
policy-list FTP_Config_Backup
!
kron policy-list FTP_Config_Backup
cli show run | redirect ftp://SWI_Br:63V9********@172.16.xx.xx/Backup_Switche/PG-CZ002X001SWI.txt

Hello,

 

what device is this on ? KRON does not work correctly on some of the newer Linux based switches. Try the EEM script below:

 

event manager applet DAILY_RUN_CONFIG_BACKUP
description Daily Run Config Backup To FTP Server
event timer cron cron-entry "0 22 * * *"
action 1.01 cli command "enable"
action 1.02 cli command "show clock"
action 1.03 regexp "(2[0-3]|[01][0-9]):([0-6][0-9]):([0-6][0-9])" "$_cli_result" time hour minute second
action 1.04 puts "$time"
action 1.05 puts "$hour"
action 1.06 puts "$minute"
action 1.07 puts "$second"
action 1.11 cli command "show clock"
action 1.12 regexp "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([1-9]|0[1-9]|[1-2][0-9]|3[0-1]) (20[1-9][0-9])" "$_cli_result" time2 month day year
action 1.13 puts "$time2"
action 1.14 puts "$month"
action 1.15 puts "$day"
action 1.16 puts "$year"
action 1.17 cli command "show run | redirect ftp://SWI_Br:63V9********@172.16.xx.xx/Backup_Switche/PG-CZ002X001SWI-$year$month$day-$hour$minute$second.txt"

 

Try exmaple :

 

cli show run | redirect ftp://SWI_Br:63V9********@172.16.xx.xx/Backup_Switche/$h__$t .txt

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Thanks for your message, how dificult is automaticlly add hostname and timestamp to my krone command?

PG-CZ003X013SWI-$year$month$day-$hour$minute$second.txt

not that diffcult @Georg Pauwen advise some script (even i do the same and test it)

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hallo, it was my first wuestion. This command does not work.

what is not working ? what is the error you getting  here please to understand the issue ?

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hi, when I use this command cli show run | redirect ftp://SWI_Br:63V9********@172.16.xx.xx/Backup_Switche/$h__$t .txt in the kron,

my FTP backup´s name is "$h__$t .txt" but not hostname-timestamp.txt

You are right, some how its not redirecting as expected on 3750 when i did test last night,

 

Can you use EEM script, does the same function what you looking

 

Note : i will do some test later and get back to you.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

$h__$t works fine.  Thank you much for your help.  There are so many info on the net about this timestamp on the file and none of them works.  This save me lots of time.  Thank you.

 

Glad that help you.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help