webif/var/mongoose/cgi-bin/backup/view.jim
hummypkg 2ab6f7caa2 0.12.0
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1398 2a923420-c742-0410-a762-8d5b09965624
2013-02-09 22:46:15 +00:00

55 lines
901 B
Plaintext
Executable File

#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require rsv.class findhsvc
set dir /mod/var/backup
httpheader
set file [file tail [cgi_get restore_file]]
if {$file == 0} {
puts "No filename supplied."
exit
}
set ffile "/$dir/$file.rbk"
if {![file exists $ffile]} {
puts "Backup file <i>$file</i> does not exist."
exit
}
if {[catch { set fd [open $ffile r] } msg]} {
puts "Error opening <i>$file</i> - $msg"
exit
}
puts "Listing scheduled events from <i>$file</i>..."
set fields [lsort [[rsv] vars]]
set data [split [read $fd] "\n"]
foreach line $data {
set vals [split $line "\t"]
if {[lindex $vals 0] ne "event"} { continue }
set vars {}
set i 0
foreach f $fields {
if {$f eq "aulEventToRecordInfo"} { continue }
incr i
lappend vars $f [lindex $vals $i]
}
set rsv [rsv new $vars]
puts " [$rsv name] ([$rsv channel_name])"
}
close $fd
rsv cleanup