%
local taskd = require "luci.model.tasks"
local status = taskd.status(self.task_id)
-- Check if a task is running
local task_running = status.running
-- Check for a task start failure
if self.task_start_failed then
%>
<%
if not task_running then
local util = require "luci.util"
local container_status = util.trim(util.exec(self.script_path.." status"))
local container_status_lower = string.lower(container_status)
local container_install = not string.match(container_status_lower, " is not installed$")
local container_running = string.match(container_status_lower, "^up%W")
if container_install then
%>
<%
if container_running then
%>
<%
else
%>
<%
end
else
%>
<%
end
else
%>
<%
end
%>
<%+tasks/embed%>
<%
if self.auto_show_task and task_running then
%>
<%
end
%>