From b87837b2f18dcab89b1ae14c22be5f9851992aaf Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 3 Mar 2020 15:57:20 -0500 Subject: [PATCH] fix: speed up service_status by reducing container status calls --- common-functions | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/common-functions b/common-functions index 1d989d5..ac6dc0d 100755 --- a/common-functions +++ b/common-functions @@ -740,13 +740,7 @@ service_status() { local ID="$(cat "$SERVICE_ROOT/ID")" local CONTAINER_STATUS - is_container_status "$ID" "Dead" && echo "dead" && return 0 - is_container_status "$ID" "OOMKilled" && echo "oomkilled" && return 0 - is_container_status "$ID" "Paused" && echo "paused" && return 0 - is_container_status "$ID" "Restarting" && echo "restarting" && return 0 - is_container_status "$ID" "Running" && echo "running" && return 0 - - CONTAINER_STATUS=$(docker inspect -f "{{.State.Status}}" "$CID" 2>/dev/null || true) + CONTAINER_STATUS=$(docker inspect -f "{{.State.Status}}" "$ID" 2>/dev/null || true) [[ -n "$CONTAINER_STATUS" ]] && echo "$CONTAINER_STATUS" && return 0 echo "missing" && return 0 }