1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix(tools): Prevent dragonfly.logrotate to stop logrotate service (#4176)

Update dragonfly.logrotate

If multiple logs are being rotated and one of them fails (due to exit 1), the other logs that follow won't be rotated either, unless logrotate is run again.

If you want to prevent the rotation of a specific log file and not affect the rest of the logs, you'll want to handle the condition properly to ensure that logrotate doesn't abort due to the failure of the prerotate script.

To prevent the rotation of a specific log file without causing issues for other logs, you can use exit 0 to prevent rotation cleanly or design your prerotate script to handle conditions carefully.

Signed-off-by: s13k <s13k@pm.me>
This commit is contained in:
s13k 2024-11-24 19:27:05 +02:00 committed by GitHub
parent 6a7f345bc5
commit ff2359af30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,7 +15,7 @@
prerotate prerotate
if lsof -t $1 > /dev/null; then if lsof -t $1 > /dev/null; then
# file is open. Skipping rotation." # file is open. Skipping rotation."
exit 1 exit 0
fi fi
endscript endscript