11-17-2016 12:45 PM - edited 03-08-2019 08:12 AM
Hi all,
I have a few ASR 9010's running IOS-XR (of which I'm not very knowledgeable) that I'm trying to configure to do a daily backup via TFTP as well as push a new sequentially named file every time a commit is performed to include when I do "end" "you have unsaved changes would you like to commit them (or something along those lines)".
The current command we're running is "configuration commit auto-save filename tftp://10.10.10.10/name-of-file.cfg". The problem with this is every time it writes it doesn't make a new name so it just overwrites the file that is already saved thus defeating the purpose of sending the backup in case I need to roll back after a bad commit.
I'm basically trying to clone the normal IOS command of below into IOS-XR:
archive
log config
hidekeys
path tftp://10.10.10.10/$h
write-memory
time-period 1440
Thank you in advance for any help
Chuck
11-17-2016 01:15 PM
Hello Chuck,
I found this TCL script in another thread, it uses the internal clock and tags the date to the file, ensuring its uniqueness:
::cisco::eem::event_register_timer cron cron_entry "0 22 * * *"
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}
array set _sinfo [sys_reqinfo_routername]
set hostname $_sinfo(routername)
if [catch {cli_exec $cli1(fd) "show clock"} cli_output] {
error $cli_output $errorInfo
} else {
set current_time $cli_output
}
set year [lindex $current_time 12]
set month [lindex $current_time 3]
set day [lindex $current_time 4]
set temp [lindex $current_time 5]
set hour [string range $temp 0 1]
set minute [string range $temp 3 4]
set second [string range $temp 6 7]
append time $hour "." $minute "." $second
append date $month "-" $day "-" $year "-" $time
append filename $hostname "-" $date
if [catch {cli_exec $cli1(fd) "sh run | file ftp://username:password@192.168.1.1/$filename"} cli_output] {
error $cli_output $errorInfo
}
if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
error $result $errorInfo
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