Files
xtrhrj/scripts/Stop-Xtrh.ps1
T

12 lines
662 B
PowerShell
Raw Normal View History

2026-10-20 08:34:12 +08:00
[CmdletBinding()]
param([string]$InstallRoot = (Split-Path -Parent $PSScriptRoot))
. (Join-Path $PSScriptRoot 'Common.ps1')
$root = [System.IO.Path]::GetFullPath($InstallRoot)
$processFile = Join-Path $root 'service-process.json'
if (-not (Test-Path -LiteralPath $processFile)) { Write-Output '此部署目录没有启动记录。'; return }
$record = Get-Content -LiteralPath $processFile -Raw | ConvertFrom-Json
$process = Get-XtrhOwnedProcess -InstallRoot $root -Record $record
if ($process) { Stop-Process -Id $process.Id -Force }
Remove-Item -LiteralPath $processFile -Force
Write-Output '此部署实例已停止;数据、身份和配置均保留。'