refined status message handling

pull/1/head
riley 1 year ago
parent e954fa24ba
commit b7a0c66b0d

@ -100,13 +100,14 @@ case "${ACTION}" in
;; ;;
"status") "status")
CONTAINER_NAME="generated_btcpayserver_1" CONTAINER_NAME="generated_btcpayserver_1"
CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk -F' ' '{print $1, $2, $3}') 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 if [ -z "$CONTAINER_STATUS" ]; then
echo "${APP_NAME} is not installed" echo "${APP_NAME} is not installed"
else else
echo "${CONTAINER_STATUS}" echo "${CONTAINER_STATUS}"
fi fi
;; ;;
"port") "port")
APP_NAME="btcpayserver" APP_NAME="btcpayserver"
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}') CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}')

Loading…
Cancel
Save