Files
proxmox/scripts/stop_ssh_tunnel.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

58 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# Stop SSH tunnel for Proxmox API access
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.10}"
PROXMOX_PORT="${PROXMOX_PORT:-8006}"
TUNNEL_PID_FILE="/tmp/proxmox-tunnel-${PROXMOX_HOST}-${PROXMOX_PORT}.pid"
# Load from .env if available
if [ -f ~/.env ]; then
export $(grep -E "^PROXMOX_" ~/.env | grep -v "^#" | xargs)
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.10}"
PROXMOX_PORT="${PROXMOX_PORT:-8006}"
fi
if [ -f "$TUNNEL_PID_FILE" ]; then
TUNNEL_PID=$(cat "$TUNNEL_PID_FILE")
if ps -p "$TUNNEL_PID" > /dev/null 2>&1; then
echo "Stopping tunnel (PID: $TUNNEL_PID)..."
kill "$TUNNEL_PID" 2>/dev/null
sleep 1
if ps -p "$TUNNEL_PID" > /dev/null 2>&1; then
echo "Force killing..."
kill -9 "$TUNNEL_PID" 2>/dev/null
fi
rm -f "$TUNNEL_PID_FILE"
echo "✅ Tunnel stopped"
else
echo "Tunnel not running (stale PID file)"
rm -f "$TUNNEL_PID_FILE"
fi
else
echo "No tunnel PID file found"
echo "Checking for running tunnels..."
# Try to find tunnel by port
LOCAL_PORT="${PROXMOX_PORT:-8006}"
PIDS=$(lsof -ti:${LOCAL_PORT} 2>/dev/null)
if [ -n "$PIDS" ]; then
echo "Found processes on port $LOCAL_PORT: $PIDS"
read -p "Kill these processes? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "$PIDS" | xargs kill 2>/dev/null
echo "✅ Processes killed"
fi
else
echo "No tunnel processes found"
fi
fi