Use manage_logs to rotate log file

This commit is contained in:
prpr 2023-07-12 02:11:13 +01:00
parent 1d243c989b
commit fb9fb6ca85

View File

@ -10,13 +10,12 @@ proc ::auto::loginit {} {
# Rotate log file if large enough. # Rotate log file if large enough.
if {[file exists $::auto::logfile] && if {[file exists $::auto::logfile] &&
[file size $::auto::logfile] > $logsize} { [file size $::auto::logfile] > $logsize} {
set tstamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}] exec /mod/webif/lib/bin/manage_logs
file rename -force $::auto::logfile "/mod/tmp/auto.$tstamp.log"
} }
# Open log file # Open log file
if {$::auto::logfd eq "unset"} { if {$::auto::logfd eq "unset"} {
set ::auto::logfd [open "/mod/tmp/auto.log" "a+"] set ::auto::logfd [open $::auto::logfile "a+"]
} }
} }