From 8221ae534cfefeb6e91ee81d9123f8f46ae80b40 Mon Sep 17 00:00:00 2001 From: Jocelyn Le Sage Date: Fri, 9 Dec 2022 14:09:00 -0500 Subject: [PATCH] Make sure log files do not grow indefinitely. --- rootfs/etc/cont-init.d/55-firefox.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rootfs/etc/cont-init.d/55-firefox.sh b/rootfs/etc/cont-init.d/55-firefox.sh index 1f89ef1..1fe8c77 100755 --- a/rootfs/etc/cont-init.d/55-firefox.sh +++ b/rootfs/etc/cont-init.d/55-firefox.sh @@ -62,10 +62,15 @@ if [ -n "$(ls /config/profile/sessionstore-backups/*.jsonlz4 2>/dev/null)" ]; th done fi -# Make sure monitored log files exist. -for LOG_FILE in /config/log/firefox/error.log +# Initialize log files. +for LOG_FILE in /config/log/firefox/output.log /config/log/firefox/error.log do touch "$LOG_FILE" + + # Make sure the file doesn't grow indefinitely. + if [ "$(stat -c %s "$LOG_FILE")" -gt 1048576 ]; then + echo > "$LOG_FILE" + fi done # vim: set ft=sh :