#!/bin/bash # shellcheck disable=SC1091 source "${AGENT_PATH}/common.sh" _check_required_env_vars "CONTAINER_NAME" echo "Cloudflare Tunnel Status" echo "========================" if ! _is_container_exists "$CONTAINER_NAME"; then echo "Status: NOT INSTALLED" echo "" echo "The Cloudflare Tunnel container does not exist." echo "Run 'ds install [server] cloudflare-tunnel' to set it up." exit 1 fi if ! _is_container_running "$CONTAINER_NAME"; then echo "Status: STOPPED" echo "" echo "The Cloudflare Tunnel container exists but is not running." echo "Run 'ds start [server] cloudflare-tunnel' to start it." exit 1 fi # Get container details CONTAINER_ID=$(_get_container_id "$CONTAINER_NAME") CONTAINER_STATUS=$(_get_container_status "$CONTAINER_NAME") echo "Status: RUNNING" echo "Container: $CONTAINER_NAME" echo "ID: $CONTAINER_ID" echo "State: $CONTAINER_STATUS" echo "" # Show recent logs to check connection status echo "Recent connection status:" echo "-------------------------" docker logs "$CONTAINER_NAME" 2>&1 | grep -E "(Registered|Connected|failed|error)" | tail -5 echo "" echo "Dashboard: https://one.dash.cloudflare.com/ -> Zero Trust -> Access -> Tunnels" echo "View full logs: ds logs [server] cloudflare-tunnel" exit 0