fix kiwix crash-loop when no ZIM files present

Replace subshell ls expansion (which produces no args when /data is empty)
with a conditional: serve ZIM files if they exist, otherwise sleep infinity
so the container stays up gracefully until ZIM files are added.

https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx
This commit is contained in:
Claude
2026-03-21 18:25:04 +00:00
parent 799fc84875
commit 2912208f87
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -938,7 +938,7 @@ ${OLLAMA_VOLUME_LINE}
volumes: volumes:
- $KIWIX_DIR:/data - $KIWIX_DIR:/data
entrypoint: ["sh", "-c"] entrypoint: ["sh", "-c"]
command: ["exec kiwix-serve $(ls /data/*.zim 2>/dev/null | tr '\\n' ' ')"] command: ["ls /data/*.zim >/dev/null 2>&1 && exec kiwix-serve /data/*.zim || { echo 'No ZIM files in /data yet - sleeping. Add .zim files and restart kiwix.'; exec sleep infinity; }"]
# ── Gitea — Self-hosted Git ───────────────────────────────────────────────── # ── Gitea — Self-hosted Git ─────────────────────────────────────────────────
gitea: gitea:
+1 -1
View File
@@ -625,7 +625,7 @@ services:
ports: ["0.0.0.0:8181:8080"] ports: ["0.0.0.0:8181:8080"]
volumes: [$BASE/kiwix:/data] volumes: [$BASE/kiwix:/data]
entrypoint: ["sh", "-c"] entrypoint: ["sh", "-c"]
command: ["exec kiwix-serve $(ls /data/*.zim 2>/dev/null | tr '\\n' ' ')"] command: ["ls /data/*.zim >/dev/null 2>&1 && exec kiwix-serve /data/*.zim || { echo 'No ZIM files in /data yet - sleeping. Add .zim files and restart kiwix.'; exec sleep infinity; }"]
gitea: gitea:
image: gitea/gitea:latest image: gitea/gitea:latest