Bug#925926: workaround

McIntyre, Vincent (S&A, Marsfield) Vincent.Mcintyre at csiro.au
Wed Aug 25 07:05:30 BST 2021


I made a workaround for this, it's extremely gross but does help.

#!/bin/sh
# refresh the mtime of logs that are held open
# run this before /etc/cron.daily/tomcat9
NAME=tomcat9
DEFAULT=/etc/default/$NAME
LOGEXT="log txt"
# Overwrite settings from default file
if [ -f "$DEFAULT" ]; then
        . "$DEFAULT"
fi

TMPDIR=$(mktemp /var/tmp/XXXXXX)
trap '[ -d "$TMPDIR" ] && rm -rf "$TMPDIR"' 0

if [ -d /var/log/$NAME ]; then
        for EXT in $LOGEXT; do
                # Compress the log files
                if [ $LOGFILE_COMPRESS = 1 ]; then
                        loglist="${TMPDIR}/${EXT}"
                        find /var/log/$NAME/ -name \*.$EXT \
                            -daystart -mtime +0 > "$loglist"
                        while read f
                        do
                           if lsof -f -- "$f" 1>/dev/null 2>&1; then
                               touch -m "$f"
                           fi
                        done < "$loglist"
                        rm "$loglist"
                        EXT=$EXT.gz
                fi
        done
fi


-- 


More information about the pkg-java-maintainers mailing list