Monthly Archives: May 2012

The Blueprint: TCL and EEM

In the previous post, I showed a simple TCL script that I used to copy multiple files from a USB stick to the CF(Flash) card of the router.

I took this a step further and wrote an EEM script that initializes and kicks off the TCL script once you insert the FLASH card into the router. I got lazy and didn’t want to perform any key strokes. With this setup, you don’t have to type any commands in the router! Pop the CF card in the router and boom…instant auto copy!

Here’s the EEM script that I wrote:

——————————–

event manager applet USB
event syslog pattern “%FILESYS-5-CF: CompactFlash inserted ”
action 1.1 cli command “enable”
action 1.2 cli command “tclsh usbflash1:TCL/usbtoflash.tcl”
action 1.3 syslog priority debugging msg “FILE COPY COMPLETE”

——————————– 

This EEM script is configured on the router that I used for all the copies. The TCL script file, usbtflash.tcl, is saved on the source location(in this example, it is the USB stick plugged into the usbflash1 slot on the router) along with all of the other files I want to copy to FLASH.

This just a small example of what you can do when you combine EEM scripting along with the TCL scripting. This script can be modified to your liking…Have fun!

….gosh those CCIE numbers are getting higher and higher…hopefully I can get one before they hit the 40K mark.

CiscoNinjaNC


The Blueprint: TCL Script

Just a simple TCL script that I typed up that copies multiple files from a USB drive to FLASH on a router. Without the script, I would have to baby sit each file copy. With this script, you run it once, and it copies all the files to FLASH. This will come in real handy becasuse I have 200+ flash cards that I have to copy these files to.

——————————————————–

tclsh
proc copy-usb-flash {} {
exec “copy flash:home.shtml usbflash1:”
exec “copy flash:cpconfig-28xx.cfg usbflash1:”
exec “copy flash:cpexpress.tar usbflash1:”
exec “copy flash:home.shtml usbflash1:”
exec “copy flash:HOME.TAR usbflash1:”
exec “copy flash:securedesktop-ios-3.1.1.45-k9.pkg usbflash1:”
exec “copy flash:sslclient-win-1.1.4.176.pkg usbflash1:”
exec “copy flash:music-on-hold.au usbflash1:”
}

##Type this to trigger the script to run
copy-usb-flash

——————————————————–

Still on the path to CCIE. Will finish review of MPLS and IP Services…and will shoot to finish 2 practice labs this weekend . Projecting a second Lab attempt in September.

Later!
CiscoNinjaNC