forked from hummypkg/webif
8dc232646b
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1709 2a923420-c742-0410-a762-8d5b09965624
38 lines
657 B
Plaintext
Executable File
38 lines
657 B
Plaintext
Executable File
#!/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 <i>$file</i> already exists."
|
|
exit
|
|
}
|
|
|
|
rsv backup $ffile
|
|
|