18 lines
551 B
PowerShell
18 lines
551 B
PowerShell
param(
|
|
[int]$ApiPort = 8001,
|
|
[switch]$StopCloudflared
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
Get-CimInstance Win32_Process |
|
|
Where-Object { $_.CommandLine -like "*uvicorn app.main:app*--port $ApiPort*" } |
|
|
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
|
|
|
if ($StopCloudflared) {
|
|
Get-CimInstance Win32_Process |
|
|
Where-Object { $_.Name -eq "cloudflared.exe" -and $_.CommandLine -like "*vignette-config.yml*" } |
|
|
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
|
}
|
|
|
|
Write-Host "Stopped public API processes on port $ApiPort"
|