#!/mod/bin/jimsh package require cgi source /mod/webif/lib/setup require rsv.class set dir "/mod/var/backup" httpheader set now [clock seconds] set file [file tail [cgi_get file \ [clock format $now -format "auto-%Y-%b-%d-%H:%M"]]] if {[string match {auto-*} $file]} { # Delete any automatic backups over 7 days old. set mt $(15 * 86400) foreach af [glob -nocomplain "$dir/auto-*"] { set aft [file mtime $af] set diff $($now - $aft) if {$diff > $mt} { puts "Removing $af" file delete $af } } } set ffile "$dir/$file.rbk" if {[file exists $ffile]} { puts "Backup file $file already exists." exit } rsv backup $ffile