2020-07-01 00:43:47 +07:00
|
|
|
$pgReadyPath = Join-Path ${env:PGBIN} "pg_isready.exe"
|
2020-06-25 16:20:48 +07:00
|
|
|
$pgReady = Start-Process -FilePath $pgReadyPath -Wait -PassThru
|
2020-06-03 17:35:03 +03:00
|
|
|
$exitCode = $pgReady.ExitCode
|
|
|
|
|
|
|
|
|
|
if ($exitCode -eq 0)
|
|
|
|
|
{
|
|
|
|
|
Write-Host -Object "PostgreSQL has been successfully installed."
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
|
|
|
|
|
exit $exitCode
|
2020-06-02 19:52:42 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#Stop and disable PostgreSQL service
|
2020-06-03 17:35:03 +03:00
|
|
|
$pgService = Get-Service -Name postgresql*
|
|
|
|
|
Stop-Service -InputObject $pgService
|
|
|
|
|
Set-Service -InputObject $pgService -StartupType Disabled
|