Modified code so that the docker logging makes sense. Also fixed a bug which can happen with iptables (-s illegal option). Pushing to repo.

This commit is contained in:
Daan
2024-06-07 13:25:46 +02:00
parent 1bcddadb7a
commit cf455fc19b
3 changed files with 11 additions and 5 deletions

View File

@@ -77,13 +77,14 @@ set_envvars() {
}
ensure_blocking() {
sleep 1s
echo "Ensuring container continuation."
# This function checks if the latest error log is created and tails it for docker logs uses.
if find "/opt/wireguardashboard/app/src/log" -mindepth 1 -maxdepth 1 -type f | read -r; then
latestlog=$(find /opt/wireguardashboard/app/src/log -name "error_*.log" | head -n 1)
sleep 3s
tail -f "${latestlog}"
latestErrLog=$(find /opt/wireguardashboard/app/src/log -name "error_*.log" | head -n 1)
latestAccLog=$(find /opt/wireguardashboard/app/src/log -name "access_*.log" | head -n 1)
tail -f "${latestErrLog}" "${latestAccLog}"
fi
# Blocking command in case of erroring. So the container does not quit.