From 2912208f874f13fddebb088b91ee7e60c30c32e8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 18:25:04 +0000 Subject: [PATCH] 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 --- laptop_full_setup.sh | 2 +- local-ai-setup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/laptop_full_setup.sh b/laptop_full_setup.sh index 52fc894..7270b57 100755 --- a/laptop_full_setup.sh +++ b/laptop_full_setup.sh @@ -938,7 +938,7 @@ ${OLLAMA_VOLUME_LINE} volumes: - $KIWIX_DIR:/data 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: diff --git a/local-ai-setup.sh b/local-ai-setup.sh index e010ba8..8f114a7 100755 --- a/local-ai-setup.sh +++ b/local-ai-setup.sh @@ -625,7 +625,7 @@ services: ports: ["0.0.0.0:8181:8080"] volumes: [$BASE/kiwix:/data] 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: image: gitea/gitea:latest