rotate_logs now rotates non-empty logs even if the service isn't running.
This commit is contained in:
parent
8f962df620
commit
7ab0d50abf
@ -10,6 +10,8 @@
|
||||
# Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
|
||||
# Kovács Zoltán <kovacsz@marcusconsulting.hu>
|
||||
# License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
# 2025-03-17 v1.2
|
||||
# mod: rotates non-empty logs even if the service isn't running.
|
||||
# 2024-08-24 v1.1
|
||||
# new: docker-compose v2 compatibility - tested with Ubuntu 24.04 LTS.
|
||||
# 2023-06-18 v1.0
|
||||
@ -98,10 +100,6 @@ CONFFILE="$CONFDIR/.${SCRFILE%.*}.conf"
|
||||
STATEFILE="$CONFDIR/.${SCRFILE%.*}.state"
|
||||
LOGDIR="${PAR_LOGDIR:-$BASE_DIR/$LOGDIR}"
|
||||
|
||||
# Doesn't rotate logs for stopped services.
|
||||
[[ -z "$(cd "$BASE_DIR"; "$DOCKER_COMPOSE" $commandstring ps --services --filter "status=running")" ]] \
|
||||
&& exit 0
|
||||
|
||||
# Locates the worker script.
|
||||
WORKERSCRIPT="$SCRPATH/copytruncate"
|
||||
[[ ! -x "$WORKERSCRIPT" ]] && WORKERSCRIPT="$(which copytruncate)"
|
||||
@ -116,6 +114,7 @@ $LOGDIR/*.log {
|
||||
missingok
|
||||
daily
|
||||
rotate 30
|
||||
notifempty
|
||||
# Must be consistent with prerotate script's settings!
|
||||
dateext
|
||||
dateyesterday
|
||||
@ -143,6 +142,7 @@ $LOGDIR/web/*.log {
|
||||
missingok
|
||||
daily
|
||||
rotate 60
|
||||
notifempty
|
||||
# Must be consistent with prerotate script's settings!
|
||||
dateext
|
||||
dateyesterday
|
||||
|
Loading…
x
Reference in New Issue
Block a user