31 lines
1.5 KiB
PowerShell
31 lines
1.5 KiB
PowerShell
# Stops a running Igneum Miner on this PC: asks the engine to quit through its local API (miners first, then the
|
|
# node), waits, then ends whatever is left. Run by the installer before an upgrade and on uninstall; also the
|
|
# Start Menu "Stop Igneum Miner" entry. 4 October 2026 (the app version; the 0.2.0 launcher's script is retired).
|
|
$ErrorActionPreference = 'Continue'
|
|
$urlFile = Join-Path $env:LOCALAPPDATA 'igneum\app\app.url'
|
|
$asked = $false
|
|
if (Test-Path $urlFile) {
|
|
$url = (Get-Content $urlFile -Raw).Trim()
|
|
if ($url) {
|
|
try {
|
|
Invoke-WebRequest -Uri ($url + 'api/quit') -Method POST -Body '{}' -ContentType 'application/json' -UseBasicParsing -TimeoutSec 5 | Out-Null
|
|
$asked = $true
|
|
Write-Host 'asked the engine to stop (miners first, then the node)'
|
|
} catch { }
|
|
}
|
|
}
|
|
if ($asked) {
|
|
$deadline = (Get-Date).AddSeconds(50)
|
|
while ((Get-Date) -lt $deadline) {
|
|
$alive = @(Get-Process -Name 'igneum-app', 'igneumd' -ErrorAction SilentlyContinue)
|
|
if ($alive.Count -eq 0) { break }
|
|
Start-Sleep -Milliseconds 500
|
|
}
|
|
}
|
|
foreach ($name in @('Igneum Miner', 'igneum-app', 'igneum-miner', 'igneum-worker-cuda', 'igneum-worker-opencl', 'igneum-bench-cuda-devnet', 'igneum-bench-cl-devnet', 'igneumd')) {
|
|
Get-Process -Name $name -ErrorAction SilentlyContinue | ForEach-Object {
|
|
Write-Host "ending $($_.ProcessName) (pid $($_.Id))"
|
|
Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue
|
|
}
|
|
}
|
|
Write-Host 'Igneum Miner is stopped.'
|