12-04-2006 04:10 AM
Hi,
I'm trying to copy files between routers (by enabling FTP server), and to FTP server on my LAN. I would like to schedule the copying using kron, and copy files in bulk (e.g. mput or cp *).
The IOS command I was hoping would work is 'copy flash:/test/* ftp:......' but this doesn't work - are there any easy ways of doing this?
Many thanks,
Michael
Solved! Go to Solution.
12-04-2006 09:08 AM
See my reply to your other post regarding TCL. However, if your goal is to use a TCL script with kron, you need to be aware that kron and TCL did not work together prior to 12.4(3). Additionally, it is better to use the Embedded Event Manager if you want to schedule TCL code to run periodically. See http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a0080559cd5.html for more on TCL scripting in EEM (note: this is NOT applicable to tclsh).
Here is a simple example for listing directory contents. You can use this to cycle over all files, and copy them as you see fit:
set fileList [glob -directory flash: -nocomplain *]
foreach file $fileList {
puts "Filename is $file"
}
12-05-2006 09:34 AM
Yes, you should definitely buy a TCL referecne book. IOS implements just about all of TCL 8.3.4. I have already pointed out the table that contains the exceptions. To that, add that IOS TCL does not yet support pipelining or reading character-by-character from stdin.
12-04-2006 04:31 AM
Hi
If you are copying files between routers , then make one of the router as tftp server and then do a copy.
Let me know if ur requirement was diff
regards
vanesh k
12-04-2006 07:17 AM
Hi,
I'd like to copy multiple files at once, e.g. copy * to another location, and then once that's done, setup a kron job to do the copy on a regular basis..
I've been reading about using TCL, but I can't find any simple examples..
Regards,
Michael
12-04-2006 09:08 AM
See my reply to your other post regarding TCL. However, if your goal is to use a TCL script with kron, you need to be aware that kron and TCL did not work together prior to 12.4(3). Additionally, it is better to use the Embedded Event Manager if you want to schedule TCL code to run periodically. See http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a0080559cd5.html for more on TCL scripting in EEM (note: this is NOT applicable to tclsh).
Here is a simple example for listing directory contents. You can use this to cycle over all files, and copy them as you see fit:
set fileList [glob -directory flash: -nocomplain *]
foreach file $fileList {
puts "Filename is $file"
}
12-05-2006 07:33 AM
Thanks, that's exactly what I was wanting to do. I've had a look at EEM, and will give it a try at some point, but I'll just test with kron for now.
My goal is to replicate certificates granted by a CA router to a standby CA router (in case the primary one goes down).
Regards,
Michael
p.s. Can you please tell me if it would be worth buying a TCL/TK reference book - is a large subset of TCL implemented in the IOS?
12-05-2006 09:34 AM
Yes, you should definitely buy a TCL referecne book. IOS implements just about all of TCL 8.3.4. I have already pointed out the table that contains the exceptions. To that, add that IOS TCL does not yet support pipelining or reading character-by-character from stdin.
12-06-2006 01:28 AM
Thanks, that's excellent.
Regards,
Michael
01-19-2007 01:48 PM
By the way: you can find some EEM script examples here:
http://www.cisco.com/go/ciscobeyond
You can share yours, too!
01-22-2007 01:36 AM
Thanks,
Much appreciated.
Regards,
Michael
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