Bring script headers onto the template and close safeguard gaps

Headers claimed protections the code never had, and several destructive paths had no
guard against a collapsed config value.
This commit is contained in:
Gmer4Lfe
2026-08-01 20:37:59 -04:00
parent cdce877601
commit e8b114094a
78 changed files with 3301 additions and 277 deletions
+24
View File
@@ -16,9 +16,33 @@
# SABnzbd) grow fastest — inactive containers typically remain small.
#
# ==============================================================================================
# OPERATIONAL MODEL
# ==============================================================================================
#
# Two independent passes, each with its own threshold:
#
# System logs — every path in LOG_FILES
# size < LOG_MIN_SIZE_MB → skip, recent diagnostic history is worth keeping
# size >= LOG_MIN_SIZE_MB → truncate in place
#
# Docker logs — /var/lib/docker/containers/**/*-json.log
# container name resolved for reporting via docker inspect
# size < LOG_DOCKER_MAX_MB → skip
# size >= LOG_DOCKER_MAX_MB → truncate in place
# containers directory missing → whole pass skipped, not an error
#
# Truncation is always `: > file`, never rm — see Truncate, Never Delete below.
# Freed bytes are totalled per pass and reported in the summary.
#
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
# Truncate, Never Delete
# Logs are emptied in place, never removed. The writing process keeps its open file
# handle and keeps logging; deleting the inode would leave a running daemon writing
# to a file nothing can read, and would consume more tmpfs, not less.
#
# Size Thresholds, Not Blind Truncation
# A 2MB syslog contains useful recent diagnostic history — not worth clearing.
# A 500MB Docker log is consuming rootfs and contains mostly noise — clear it.