13 lines
680 B
PowerShell
13 lines
680 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|||
|
|
$repo = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||
|
|
$localDir = Join-Path $repo 'target/local'
|
||
|
|
$pidFile = Join-Path $localDir 'app.pid'
|
||
|
|
if (Test-Path $pidFile) {
|
||
|
|
$app = Get-Process -Id ([int](Get-Content $pidFile)) -ErrorAction SilentlyContinue
|
||
|
|
if ($app -and $app.Path -eq (Join-Path $localDir 'meguri-dev.exe')) { Stop-Process -Id $app.Id }
|
||
|
|
Remove-Item -LiteralPath $pidFile
|
||
|
|
}
|
||
|
|
if (Test-Path (Join-Path $localDir 'settings.json')) {
|
||
|
|
$settings = Get-Content (Join-Path $localDir 'settings.json') | ConvertFrom-Json
|
||
|
|
& (Join-Path $settings.postgresBin 'pg_ctl.exe') -D (Join-Path $localDir 'postgres') -m fast -w stop
|
||
|
|
}
|