From a78610eb689bd00a72bb4075bc5bca49a52e6c63 Mon Sep 17 00:00:00 2001 From: buanet Date: Mon, 27 Jul 2020 23:11:05 +0200 Subject: [PATCH] healthcheck testing --- amd64/scripts/healthcheck.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/amd64/scripts/healthcheck.sh b/amd64/scripts/healthcheck.sh index a611b48..d54b7cc 100644 --- a/amd64/scripts/healthcheck.sh +++ b/amd64/scripts/healthcheck.sh @@ -2,14 +2,19 @@ # Script checks health of running container -if [ "$(cat /opt/iobroker/.docker_config/.healthcheck)" == "starting" ] || [ "$(cat /opt/iobroker/.docker_config/.healthcheck)" == "maintenance" ] +if [ "$(cat /opt/iobroker/.docker_config/.healthcheck)" == "starting" ] then + echo 'Health status: OK - Startup script is still running.' + exit 0 +elif [ "$(cat /opt/iobroker/.docker_config/.healthcheck)" == "maintenance" ] +then + echo 'Health status: OK - Container running in maintenance mode.' + exit 0 +elif [ "$(ps -fe|grep "[i]obroker.js-controller"|awk '{print $2}')" != "" ] +then + echo 'Health status: OK - Main process (js-controller) is running.' exit 0 -else - if [ "ps -fe|grep "[i]obroker.js-controller"|awk '{print $2}'" != "" ] - then - exit 0 - fi fi +echo 'Health status: !!! NOT OK !!! - Something went wrong. Please see Container Logs for more details.' exit 1