V8.13.192.2025.10.18
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m45s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-10-18 18:40:07 +01:00
parent 9ea13fade8
commit 3cb59698cf
5 changed files with 86 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ declare var_file="" var_log=""
export DEBIAN_FRONTEND="noninteractive"
rm -f "/etc/logrotate.conf"
cat << EOF >> "/etc/logrotate.conf"
cat << EOF >| "/etc/logrotate.conf"
# See "man logrotate" for details. Global options do not affect preceding include directives.
# rotate log files daily
@@ -52,16 +52,6 @@ include /etc/logrotate.d
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=conf
EOF
for var_log in "${ary_logrotate[@]}"; do
var_file="$/etc/logrotate.d/${var_log}"
[[ -e "${var_file}" ]] || continue
### Replace leading 'monthly'/'weekly' directives with 'daily', preserving indentation and trailing comments.
sed -E -i \
-e 's/^([[:space:]]*)(monthly|weekly)([[:space:]]*)(#.*)?$/\1daily\3\4/' \
-e 's/^([[:space:]]*)rotate([[:space:]]+[0-9]+)?([[:space:]]*)(#.*)?$/\1rotate 384\3\4/' \
"${var_file}"
done
printf "\e[92m++++ ++++ ++++ ++++ ++++ ++++ ++ ✅ '%s' applied successfully. \e[0m\n" "${0}"
exit 0