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 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">

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

Loading…
Cancel
Save