forked from hummypkg/webif
Protect log rotation operations by lock
This commit is contained in:
parent
fb9fb6ca85
commit
d22735af68
|
@ -1,13 +1,20 @@
|
|||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require settings.class
|
||||
require settings.class lock
|
||||
|
||||
set s [settings]
|
||||
set logsize [$s logsize]
|
||||
set logkeep [$s logkeep]
|
||||
set logage [$s logage]
|
||||
|
||||
defer {catch {release_lock webif_autolog}}
|
||||
if {![acquire_lock webif_autolog]} {
|
||||
acquire_lock webif_autolog 10 1
|
||||
puts "Could not acquire exclusive lock, terminating."
|
||||
exit
|
||||
}
|
||||
|
||||
puts "Rotating at $logsize, keeping $logkeep, max age $logage"
|
||||
|
||||
set logdir "/mod/tmp"
|
||||
|
|
Loading…
Reference in New Issue