I've created a tcl script that will run once a day and delete log files when they are older than 30 days, instead of using crontab. If anyone would like to use it, here it is:
Code: Select all
foreach bind [binds logs] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
bind time - "00 00 * * *" logs
proc logs {min hour day month year} {
putlog "Deleting logs"
foreach file [glob -nocomplain -directory logs *.log] {
set time [clock seconds]
set log [file mtime $file]
set diff [expr ($time - $log) / 86400]
if {$diff >= 30} {
putlog "Deleting $file"
file delete -force $file
}
}
}
putlog "Crontab loaded"