03-17-2018 04:18 AM - edited 03-01-2019 06:28 PM
Hi,
I'm trying to make TCL scrip to copy running config to tftp server but when I use date env I get error.
when I copy this text to tcl I get file is created but without any data
-------------------------------------------------------------------------
tclsh
set x [ open "flash:backmeupnow.tcl" w+]
set time [clock format [clock seconds] -format "%H%M%S"]
set ken { write mem
show run | redirect tftp://10.0.3.122/Routers_Config/S05-RW877W-.$time._v1.txt
}
puts $x $time $ken
close $x
tclquit
---------------------------------------------------------------------------------
if I remove the $time from puts It's create the file but when I run the TCL I get error
can't read "time": no such variable
while executing
"show run | redirect tftp://10.0.3.122/Routers_Config/S05-RW877W-.$time._v1.txt "
(file "backmeupnow.tcl" line 2)
Regards
Marwan Urabi
03-17-2018 04:32 AM - edited 03-17-2018 04:37 AM
Hi
This format always worked for me:
set systemTime [clock seconds]
set timestemp "[clock format $systemTime -format %Y-%m-%d_%H%M]"
set nomearc "file-name"
log_file "${nomearc}${timestemp}.txt"
-If I helped you somehow, please, rate it as useful.-
03-17-2018 04:52 AM
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