From d9162384e8a4f1ef056cf48f6562623ed66e47f6 Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 13 Apr 2026 13:54:52 -0400 Subject: [PATCH] Fixed healthcheck --- Dockerfile | 5 +++-- ddns.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 879e679..c5a1245 100755 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ RUN chmod 755 ddns.py USER ddns # Simple liveness probe: process is running -HEALTHCHECK --interval=60s --timeout=5s --start-period=10s --retries=3 \ - CMD pgrep -f ddns.py || exit 1 +HEALTHCHECK --interval=60s --timeout=5s --start-period=30s --retries=3 \ + CMD python -c "import time, sys; d=open('/tmp/heartbeat').read(); sys.exit(0 if time.time()-float(d) < ${RECHECK_SECS:-900}+60 else 1)" + ENTRYPOINT ["python", "-u", "ddns.py"] diff --git a/ddns.py b/ddns.py index 511a610..f0d277f 100755 --- a/ddns.py +++ b/ddns.py @@ -205,7 +205,10 @@ def main() -> None: cfg["max_retries"], domain, ) - + + # Update heartbeat file for Docker healthcheck + with open("/tmp/heartbeat", "w") as f: + f.write(str(time.time())) if __name__ == "__main__": main()