Wait for mongodb service running (#6030)

This commit is contained in:
Aleksandr Chebotov
2022-08-08 15:55:18 +02:00
committed by GitHub
parent f1bb031e43
commit bf34dfb00a

View File

@@ -14,6 +14,10 @@ $mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE '$mongodbService'
$mongoBin = Split-Path -Path $mongoPath.split('"')[1] $mongoBin = Split-Path -Path $mongoPath.split('"')[1]
Add-MachinePathItem "$mongoBin" Add-MachinePathItem "$mongoBin"
# Wait for mongodb service running
$svc = Get-Service $mongodbService
$svc.WaitForStatus('Running','00:01:00')
# Stop and disable mongodb service # Stop and disable mongodb service
Stop-Service -Name $mongodbService Stop-Service -Name $mongodbService
Set-Service $mongodbService -StartupType Disabled Set-Service $mongodbService -StartupType Disabled