From 032a6ee1722348b5459d82a5da8f6d0df218783b Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Wed, 9 Jan 2019 19:55:32 +0100 Subject: [PATCH] Healthcheck now works python replaced by (much smaller) jq closes #24 --- Dockerfile | 2 ++ recorder-health.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index df2dcce..aac9d93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,8 @@ RUN apk add --no-cache --virtual .build-deps \ && rm -rf /usr/local/source \ && chmod 755 /usr/local/sbin/recorder-health.sh \ && apk del .build-deps +RUN apk add --no-cache \ + curl jq VOLUME ["/store", "/config"] diff --git a/recorder-health.sh b/recorder-health.sh index 745dab3..02e65ef 100644 --- a/recorder-health.sh +++ b/recorder-health.sh @@ -21,7 +21,7 @@ curl -sSL --data "${location}" "http://${addr}:${port}/pub?u=ping&d=ping" > /dev # obtain tst of ping/ping's last location ret_epoch=$(curl -sSL http://${addr}:${port}/api/0/last --data "user=ping&device=ping" | - env python -c 'import sys, json; print json.load(sys.stdin)[0]["tst"];') + env jq -r '.[0].tst' ) if [ $epoch -ne $ret_epoch ]; then echo PANIC $epoch $ret_epoch