cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1063
Views
5
Helpful
2
Replies

Saving a variable's content to file in 12.2

Evgueni Pavlov
Level 1
Level 1

I got an applet that runs fine on 15, but since 12.2 doesn't have "file" manipulations I am stuck.

Here is the code:

event manager applet PBU authorization bypass
description This applet makes Post Implementation Backup of the running-config to FLASH and TFTP.
event none default 10000 maxrun 10000
action 10000 comment ### Back UP ###
action 10010 info type routername
action 10020 set filename "POST-BU"
action 10030 set flash flash:
action 10040 regexp "([A-Za-z]+)" $_event_pub_time match month
action 10050 regexp "([0-9]+)" $_event_pub_time match date
action 10060 regexp "([0-9]+):.*" $_event_pub_time match hour
action 10070 regexp ":([0-9]+):.*" $_event_pub_time match minute
action 10080 puts "Type in your TFTP IP address (eg. xxx.xxx.xxx.xxx)"
action 10090 gets x
action 10100 set TFTP "tftp://$x/"
action 10110 cli command "enable"
action 10120 cli command "config t"
action 10130 cli command "file prompt quiet"
action 10140 cli command "exit"
action 10150 cli command "show run view | sec exc event manager | action"
action 10160 file open fh nvram:startup-config w
action 10170 file write fh "$_cli_result"
action 10180 file close fh
action 10190 cli command "copy startup-config $flash$_info_routername-$filename-$month$date-$hour$minute"
action 10200 cli command "copy startup-config $TFTP$_info_routername-$filename-$month$date-$hour$minute"
action 10210 cli command "config t"
action 10220 cli command "no file prompt quiet"
action 10230 cli command "end"
action 10240 puts "All Done"
action 10250 wait 1
action 10260 exit

Can anybody suggest of how to write $_CLI_RESULT to a file in 12.2?

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Take this applet to https://www.marcuscom.com/convert_applet/ .  You'll need to use Tcl to get this functionality in 12.2 code.

View solution in original post