status polling in shell script

pull/1/head
riley 1 year ago
parent 9ff603d694
commit df54832be9

@ -178,7 +178,13 @@ case "${ACTION}" in
"status") "status")
APP_NAME="frigate" APP_NAME="frigate"
CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}' CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }')
if [ -z "$CONTAINER_STATUS" ]; then
echo "${APP_NAME} is not installed"
else
echo "${CONTAINER_STATUS}"
fi
;;
;; ;;
"port") "port")
APP_NAME="frigate" APP_NAME="frigate"

Loading…
Cancel
Save