This commit is contained in:
urieljarethbusiness-cpu
2026-05-17 10:14:14 -06:00
parent d8773b2508
commit 64b3d15b90
61 changed files with 7612 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
param(
[Parameter(Mandatory = $true)]
[string]$Root
)
$ErrorActionPreference = "SilentlyContinue"
$Root = $Root.Trim().Trim('"').TrimEnd("\")
$Root = (Resolve-Path -LiteralPath $Root).Path.TrimEnd("\")
$Runtime = Join-Path $Root ".runtime"
function Stop-Tree([int]$Id) {
Get-CimInstance Win32_Process | Where-Object { $_.ParentProcessId -eq $Id } | ForEach-Object { Stop-Tree $_.ProcessId }
Stop-Process -Id $Id -Force
}
Write-Host ""
Write-Host "============================================"
Write-Host " Knowledge Station - Cerrar plataforma"
Write-Host "============================================"
Write-Host ""
if (!(Test-Path $Runtime)) {
Write-Host "No hay registro de servicios abiertos."
exit 0
}
foreach ($name in @("backend.pid", "frontend.pid", "server.pid")) {
$file = Join-Path $Runtime $name
if (Test-Path $file) {
$raw = Get-Content $file | Select-Object -First 1
if ($raw) { Stop-Tree ([int]$raw) }
}
}
Get-CimInstance Win32_Process |
Where-Object {
$_.CommandLine -and
$_.CommandLine -like "*$Root*" -and
($_.CommandLine -like "*uvicorn*backend.app.main:app*" -or $_.CommandLine -like "*next*dev*")
} |
ForEach-Object { Stop-Tree $_.ProcessId }
foreach ($name in @("backend.pid", "frontend.pid", "server.pid", "backend.port", "frontend.port", "last.url")) {
Remove-Item (Join-Path $Runtime $name) -Force
}
Write-Host "Plataforma cerrada de forma segura." -ForegroundColor Green