Add web GUI, docs, scripts, and 5G router config
- Web app (Flask): status, config, firewall, logs, users, restart - Docs: AT commands, deploy, DNS, quickstart, web GUI - Scripts: connect, deploy, diag, healthcheck, modem-status, speedtest, status, troubleshoot - Init and iptables: 5g-router, 5g-webgui, rules.v4 - CHANGELOG, TODO, REVISION; config and README updates
This commit is contained in:
21
scripts/rotate-5g-log.sh
Normal file
21
scripts/rotate-5g-log.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Rotate /var/log/5g-router.log (keep last 5 copies, max 1MB each)
|
||||
# Run from cron daily: 0 3 * * * /usr/local/bin/rotate-5g-log.sh
|
||||
# Alpine does not ship logrotate by default; this is a minimal alternative.
|
||||
# Rev: 1 (see REVISION in repo root)
|
||||
|
||||
LOG="/var/log/5g-router.log"
|
||||
MAXSIZE=$((1024 * 1024)) # 1MB
|
||||
KEEP=5
|
||||
|
||||
[ ! -f "$LOG" ] && exit 0
|
||||
size=$(stat -c %s "$LOG" 2>/dev/null) || size=$(wc -c < "$LOG" 2>/dev/null) || exit 0
|
||||
[ "$size" -lt "$MAXSIZE" ] && exit 0
|
||||
|
||||
for i in $(seq $((KEEP - 1)) -1 1); do
|
||||
[ -f "${LOG}.$i" ] && mv "${LOG}.$i" "${LOG}.$((i+1))"
|
||||
done
|
||||
[ -f "${LOG}.1" ] && mv "${LOG}.1" "${LOG}.2"
|
||||
mv "$LOG" "${LOG}.1"
|
||||
touch "$LOG"
|
||||
chmod 644 "$LOG" 2>/dev/null || true
|
||||
Reference in New Issue
Block a user