how to call tcl script from tftp server in VTY ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2011 07:41 AM
Hello ,
I need to know how to call tcl script from remote tftp server to excute in VTY for autocommand .
my server ip is 172.17.8.19 and tcl script is lying in xyzauto folder , i have chnage the access and the access rights on linux server as below .
-rwxrwxrwx
and the folder has access
drwxrwxrwx
kindly assist me on priority
and tcl file is as below
::cisco::eem::event_register_none
#
# Namespace imports
#
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
#
#
proc CLICmdProc {cmds} {
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}
if [catch {cli_exec $cli1(fd) "enable"} result] {
error $result $errorInfo
}
if [catch {cli_exec $cli1(fd) "term len 0"} result] {
error $result $errorInfo
}
foreach a_cmd $cmds {
if [catch {cli_exec $cli1(fd) $a_cmd} result] {
error $result $errorInfo
} else {
lappend cmd_output $result
}
}
if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
error $result $errorInfo
}
return $cmd_output
}
#
# Put commands here
#
# enhancement - read them from a file
#
lappend clicmd "term len 0"
lappend clicmd "sho run"
#
set cliout [CLICmdProc $clicmd]
#
# write to a file
#
#
if [file exists $_ofilename] {
puts "file $_ofilename being overwritten"
}
set myfileid [open $_ofilename w+]
foreach outs $cliout {
puts $myfileid $outs
}
close $myfileid
- Labels:
-
Network Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2011 10:17 AM
This is an EEM Tcl policy and will not work for what you want to do. For what you want to do, you need a simple Tcl script with the following contents:
term length 0
puts [exec "show run"]
Assuming this script was named "autocmd.tcl" on your TFTP server, it can be loaded with autocommand using:
autocommand tclsh tftp://10.1.1.1/autocmd.tcl
