
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 35s
62 lines
1.8 KiB
Bash
Executable File
62 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# shellcheck disable=SC1091
|
|
source "${AGENT_PATH}/common.sh"
|
|
_check_required_env_vars "CONTAINER_NAME"
|
|
|
|
# Tailscale Status Script
|
|
|
|
echo "Tailscale Service Status"
|
|
echo "========================"
|
|
|
|
# Check if container exists
|
|
if ! _is_container_exists "$CONTAINER_NAME"; then
|
|
echo "Status: Not Installed"
|
|
echo "The Tailscale container does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if container is running
|
|
if ! _is_container_running "$CONTAINER_NAME"; then
|
|
echo "Status: Stopped"
|
|
echo "The Tailscale container exists but is not running."
|
|
echo ""
|
|
echo "To start the service, run:"
|
|
echo " ${SERVICE_PATH}/start.sh"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Status: Running"
|
|
echo ""
|
|
|
|
# Get Tailscale connection status
|
|
echo "Tailscale Connection Status:"
|
|
echo "----------------------------"
|
|
if docker exec ${CONTAINER_NAME} tailscale status --json >/dev/null 2>&1; then
|
|
# Get basic status
|
|
docker exec ${CONTAINER_NAME} tailscale status 2>/dev/null || {
|
|
echo "Unable to get Tailscale status. The daemon may still be starting."
|
|
}
|
|
|
|
echo ""
|
|
echo "Tailscale IP Address:"
|
|
docker exec ${CONTAINER_NAME} tailscale ip -4 2>/dev/null || echo "Not connected"
|
|
|
|
echo ""
|
|
echo "Device Name:"
|
|
docker exec ${CONTAINER_NAME} tailscale status --json 2>/dev/null | \
|
|
docker exec -i ${CONTAINER_NAME} sh -c 'cat | grep -o "\"Self\":{[^}]*}" | grep -o "\"HostName\":\"[^\"]*\"" | cut -d":" -f2 | tr -d "\""' 2>/dev/null || echo "Unknown"
|
|
else
|
|
echo "Tailscale is running but not yet connected to the network."
|
|
echo "This might be normal if the container was just started."
|
|
fi
|
|
|
|
echo ""
|
|
echo "Container Information:"
|
|
echo "----------------------"
|
|
docker ps --filter "name=${CONTAINER_NAME}" --format "table {{.Status}}\t{{.Ports}}"
|
|
|
|
echo ""
|
|
echo "To view detailed logs, run:"
|
|
echo " ${SERVICE_PATH}/logs.sh"
|
|
|
|
exit 0 |