LibrePortal/scripts/app/app_status.sh
librelad a3afb2aeae feat(model-a): run app as manager; route bare docker calls through runFileOp
Model A prototype (run start.sh AS the manager, escalate only via helpers):
- check_root.sh: accept the manager user, not root-only (init.sh keeps its own
  install-time root check).
- init.sh: guard the top-level root-check + installer entrypoint with
  BASH_SOURCE!=$0 so it runs ONLY when init.sh is executed directly; when
  start.sh sources it as the manager the entrypoint (and its root check) no
  longer fires.

Also: convert bare daemon-touching 'docker' calls (no helper -> hit the
nonexistent /var/run socket in rootless) to runFileOp docker across
app_status, app_health_*, network_prune, ip_is_available, check_docker_network,
backup_db (db dumps) and crontab_check_processor. cd&&compose rooted-branches
and 'docker compose --version' checks left as-is (rooted-only / no daemon).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-24 16:53:37 +01:00

42 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# App Status Function
# Shows status for a specific LibrePortal application
appStatus()
{
local app_name="$1"
if [[ -z "$app_name" ]]; then
isError " Please provide an app name"
echo "Usage: libreportal app status [app_name]"
return 1
fi
local app_dir="$containers_dir/$app_name"
local compose_file="$app_dir/docker-compose.yml"
if [[ ! -f "$compose_file" ]]; then
isError "App '$app_name' not found or no docker-compose.yml exists"
return 1
fi
isHeader "App Status: $app_name"
# Check if container is running
if runFileOp docker ps --format '{{.Names}}' | grep -q "^${app_name}$"; then
isSuccessful "Container: RUNNING"
else
isNotice "Container: STOPPED"
fi
# Show basic container info if running
if runFileOp docker ps --format '{{.Names}}' | grep -q "^${app_name}$"; then
echo ""
echo "Container Information:"
runFileOp docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep "$app_name" || echo "No port information available"
fi
echo ""
}