#!/bin/bash
cd "C:/Claw 2/Nghien cuu/Dashboard-CSDL" || exit 1
echo "  --- tắt server cũ:"
powershell -NoProfile -Command "Get-CimInstance Win32_Process | Where-Object { \$_.CommandLine -like '*server_powerbi*' } | ForEach-Object { Stop-Process -Id \$_.ProcessId -Force -ErrorAction SilentlyContinue; 'da tat ' + \$_.ProcessId }" 2>&1 | grep -E 'da tat' | sed 's/^/    /'
sleep 3
P=$(netstat -ano | grep LISTENING | grep ':8097' | awk '{print $NF}' | sort -u | head -1)
if [ -z "$P" ]; then echo "    cổng 8097 TRỐNG ok"; else echo "    CÒN bị giữ bởi pid=$P"; fi
