All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 14s
27 lines
559 B
Bash
Executable File
27 lines
559 B
Bash
Executable File
#!/bin/bash
|
|
# shellcheck disable=SC1091
|
|
source "${AGENT_PATH}/common.sh"
|
|
_check_required_env_vars "CONTAINER_NAME"
|
|
|
|
if ! command -v lxc &>/dev/null; then
|
|
echo "Unknown"
|
|
exit 0
|
|
fi
|
|
|
|
if ! lxc info "${CONTAINER_NAME}" &>/dev/null; then
|
|
echo "Unknown"
|
|
exit 0
|
|
fi
|
|
|
|
if ! lxc info "${CONTAINER_NAME}" 2>/dev/null | grep -q "Status: RUNNING"; then
|
|
echo "Stopped"
|
|
exit 0
|
|
fi
|
|
|
|
# Container is running - check if tailscale is connected
|
|
if lxc exec "${CONTAINER_NAME}" -- tailscale status &>/dev/null; then
|
|
echo "Running"
|
|
else
|
|
echo "Error"
|
|
fi
|