#!/usr/bin/env bash
set -euo pipefail

DISPLAY_ID="${HUAWEI_BROWSER_DISPLAY:-:98}"
VNC_PORT="${HUAWEI_BROWSER_VNC_PORT:-5908}"
NOVNC_PORT="${HUAWEI_BROWSER_NOVNC_PORT:-6088}"

pkill -f "huawei_browser_profile" 2>/dev/null || true
pkill -f "127.0.0.1:${NOVNC_PORT}" 2>/dev/null || true
pkill -f "rfbport ${VNC_PORT}" 2>/dev/null || true
pkill -f "Xvfb ${DISPLAY_ID}" 2>/dev/null || true

echo "华为云服务器浏览器登录窗口已停止。"
