vignette/scripts/dev-down.ps1
2026-06-27 11:20:24 +09:00

32 lines
1.2 KiB
PowerShell

<#
.SYNOPSIS
Vignette 로컬 개발 스택(게이트웨이 9099 + API 8000 + 웹 5173)을 정리한다.
.DESCRIPTION
커맨드라인 기준으로 정확히 종료한다(고아 워커/리로더 포함). scripts/dev-up.ps1 의 짝.
.EXAMPLE
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\dev-down.ps1
#>
param(
[int]$ApiPort = 8000
)
$ErrorActionPreference = 'SilentlyContinue'
function Stop-Stale([string]$pattern, [string]$label) {
Get-CimInstance Win32_Process |
Where-Object { ($_.Name -eq 'python.exe' -or $_.Name -eq 'node.exe') -and $_.CommandLine -and $_.CommandLine -match $pattern } |
ForEach-Object {
Write-Host (" stop {0,-8} PID {1}" -f $label, $_.ProcessId)
Stop-Process -Id $_.ProcessId -Force
}
}
Write-Host "로컬 dev 스택 종료..."
Stop-Stale 'engine_gateway\.gateway' 'gateway'
Stop-Stale 'app\.main:app' 'api'
Stop-Stale 'vite' 'web'
Get-NetTCPConnection -LocalPort $ApiPort -State Listen -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty OwningProcess -Unique |
Where-Object { $_ -and $_ -ne 0 } |
ForEach-Object { Stop-Process -Id $_ -Force }
Start-Sleep -Seconds 1
Write-Host "완료."