Spaces:
Sleeping
Sleeping
| [CmdletBinding()] | |
| param() | |
| $Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path | |
| $RunDir = Join-Path $Root ".jackailocal\run" | |
| function Stop-PidFile([string]$Path) { | |
| if (!(Test-Path $Path)) { return } | |
| $pidText = (Get-Content -Raw -Path $Path).Trim() | |
| $pidValue = 0 | |
| if ([int]::TryParse($pidText, [ref]$pidValue)) { | |
| $process = Get-Process -Id $pidValue -ErrorAction SilentlyContinue | |
| if ($process) { | |
| Stop-Process -Id $pidValue -Force -ErrorAction SilentlyContinue | |
| } | |
| } | |
| Remove-Item -LiteralPath $Path -Force -ErrorAction SilentlyContinue | |
| } | |
| Stop-PidFile (Join-Path $RunDir "jackailocald.pid") | |
| Stop-PidFile (Join-Path $RunDir "ollama.pid") | |
| Get-Process jackailocald,ollama,llama-server -ErrorAction SilentlyContinue | | |
| Where-Object { $_.Path -and $_.Path.StartsWith($Root, [System.StringComparison]::OrdinalIgnoreCase) } | | |
| Stop-Process -Force -ErrorAction SilentlyContinue | |
| Write-Host "JackAILocal stopped." | |