cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
104
Views
0
Helpful
1
Replies
Beginner

Try to using TCL to read out the management IP address, then using the IP as backup file name by Korn

I am going to use management Ip address of each switch as the backup name.  But sounds it never work.  The tclsh part is functional work, but it can not work with Korn.

 

kron policy-list TEST
   cli tclsh set result [exec sh ip int brief | inc Vlan]
   cli tclsh regexp {([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)} $result match ip

cli show run | redirect ftp://username:password@10.10.12.123/$ip.cfg   -->$ip is the management IP address that I got from above tcl secript
kron occurrence TEST in 2 recurring
policy-list TEST

sam wang
1 REPLY 1
Highlighted
Beginner

the debug is as following :

the debug is as following :

 

000121: Jun  5 15:57:51 EDT: Major 1, Minor 0
000122: Jun  5 15:57:51 EDT: Timer Event TEST
000123: Jun  5 15:57:51 EDT: Kron delay for next TEST 60000
000124: Jun  5 15:57:51 EDT: Call parse_cmd 'tclsh set result [exec sh ip int brief | inc Vlan]'
000125: Jun  5 15:57:51 EDT: Kron CLI return 0
'
**CLI 'tclsh set result [exec sh ip int brief | inc Vlan]': 
couldn't read file "set": No such file or directory'
000126: Jun  5 15:57:51 EDT: Major 4, Minor 7
000127: Jun  5 15:57:51 EDT: Respond to end of CLI Process
000128: Jun  5 15:57:51 EDT: Call parse_cmd 'tclsh regexp {([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)} $result match ip'
000129: Jun  5 15:57:51 EDT: Kron CLI return 0
'
160k2flSW105#
**CLI 'tclsh regexp {([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)} $result match ip': 
couldn't read file "regexp": No such file or directory'
000130: Jun  5 15:57:51 EDT: Major 4, Minor 7
000131: Jun  5 15:57:51 EDT: Respond to end of CLI Process
000132: Jun  5 15:57:51 EDT: Call parse_cmd 'show run | redirect ftp://big:big@10.10.42.123/$ip.cfg'
160k2flSW105#
000133: Jun  5 15:57:56 EDT: Kron CLI return 0
'
**CLI 'show run | redirect ftp://username:password@10.10.12.123/$ip.cfg': 
Writing $ip.cfg '
000134: Jun  5 15:57:56 EDT: Major 4, Minor 7
000135: Jun  5 15:57:56 EDT: Respond to end of CLI Process

sam wang
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards