08-11-2021 05:29 AM
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?
Solved! Go to Solution.
08-11-2021 05:53 AM
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
!
08-11-2021 05:53 AM
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
!
03-21-2022 07:52 PM
Hi, I have switch 3750 but in my backup kron $h__$t does not work. Please help me with this problem?
03-22-2022 01:17 AM
Hello,
post the backup configuration you have. What output do you get ?
03-22-2022 03:07 AM
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
03-22-2022 04:22 AM
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"
03-22-2022 04:23 AM
Try exmaple :
cli show run | redirect ftp://SWI_Br:63V9********@172.16.xx.xx/Backup_Switche/$h__$t .txt
03-22-2022 05:36 AM
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
03-22-2022 07:32 AM
not that diffcult @Georg Pauwen advise some script (even i do the same and test it)
03-22-2022 09:40 AM
Hallo, it was my first wuestion. This command does not work.
03-22-2022 10:35 AM
what is not working ? what is the error you getting here please to understand the issue ?
03-23-2022 01:37 AM
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
03-24-2022 04:55 AM
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.
08-11-2021 06:11 AM
excellent, thank you very much, works perfect.
08-11-2021 06:13 AM
nice and good to know it works, we mark this as resolved now for the other community user can use as solution.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide