islandsurvivalcraft/test-server/end_process.ps1

9 lines
281 B
PowerShell

if (Test-Path ./test-server.pid) {
$sID = Get-Item -Path ./test-server.pid | Get-Content -Tail 1
if (Get-Process -Id $sID -ErrorAction SilentlyContinue) {
Stop-Process -Id $sID
}
Remove-Item "./test-server.pid"
} else {
Write-Output "Couldn't find running server to stop."
}