feat: add managed ACME listener and log rotation

This commit is contained in:
chermack
2026-07-26 06:37:49 +08:00
parent 3cd9c2e9c8
commit 084577c910
5 changed files with 31 additions and 4 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail
log=/var/log/trojan.log
limit=$((20 * 1024 * 1024))
[[ -f "$log" ]] || exit 0
size=$(stat -c %s "$log")
(( size < limit )) && exit 0
rm -f "${log}.5.gz"
for n in 4 3 2 1; do
[[ -f "${log}.${n}.gz" ]] && mv "${log}.${n}.gz" "${log}.$((n + 1)).gz"
done
cp "$log" "${log}.1"
: > "$log"
gzip -f "${log}.1"