Fixed status polling for healthy container

pull/1/head
riley 1 year ago
parent 4795f05880
commit 5d5d48a1aa

@ -1,7 +1,7 @@
<% <%
local util = require "luci.util" local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/apps/btcpayserver/btcpayserver.sh status")) local container_status = util.trim(util.exec("/usr/libexec/apps/btcpayserver/btcpayserver.sh status"))
local container_running = string.find(string.lower(container_status), "up") and string.find(string.lower(container_status), "(healthy)") local container_running = string.match(string.lower(container_status), "^up .* (seconds|minutes|hours)")
-%> -%>
<div class="cbi-value"> <div class="cbi-value">

@ -99,12 +99,12 @@ case "${ACTION}" in
done done
;; ;;
"status") "status")
APP_NAME="btcpayserver" CONTAINER_NAME="generated_btcpayserver_1"
CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk -F' ' '{print $1, $2, $3}')
if [ -z "$CONTAINER_NAMES" ]; then if [ -z "$CONTAINER_STATUS" ]; then
echo "${APP_NAME} is not installed." echo "${APP_NAME} is not installed."
else else
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}' echo "${CONTAINER_STATUS}"
fi fi
;; ;;
"port") "port")

Loading…
Cancel
Save