chore: clean up script
This commit is contained in:
+15
-7
@@ -24,16 +24,26 @@ function StartContainer {
|
|||||||
|
|
||||||
while ($running -eq $false -and $attempts -lt $attemptLimit)
|
while ($running -eq $false -and $attempts -lt $attemptLimit)
|
||||||
{
|
{
|
||||||
$response = Invoke-WebRequest -Uri "http://localhost:$containerHostPort/rss" -UseBasicParsing
|
try
|
||||||
|
|
||||||
if ($response.StatusCode -eq 200)
|
|
||||||
{
|
{
|
||||||
$running = $true
|
$response = Invoke-WebRequest -Uri "http://localhost:$containerHostPort/rss" -UseBasicParsing
|
||||||
|
|
||||||
|
if ($response.StatusCode -eq 200)
|
||||||
|
{
|
||||||
|
$running = $true
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "Waiting for $containerName container to start..."
|
||||||
|
Start-Sleep -Seconds $waitTimeInSeconds
|
||||||
|
$attempts++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch
|
||||||
{
|
{
|
||||||
Write-Host "Waiting for $containerName container to start..."
|
Write-Host "Waiting for $containerName container to start..."
|
||||||
Start-Sleep -Seconds $waitTimeInSeconds
|
Start-Sleep -Seconds $waitTimeInSeconds
|
||||||
|
$attempts++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,8 +116,6 @@ if ($LASTEXITCODE -ne 0)
|
|||||||
# Checkif green container is running
|
# Checkif green container is running
|
||||||
$greenContainerId = docker ps --filter "name=blog.stevanfreeborn.com.green" --format "{{.ID}}"
|
$greenContainerId = docker ps --filter "name=blog.stevanfreeborn.com.green" --format "{{.ID}}"
|
||||||
|
|
||||||
Write-Host "Green container ID: $greenContainerId"
|
|
||||||
|
|
||||||
if ($null -eq $greenContainerId)
|
if ($null -eq $greenContainerId)
|
||||||
{
|
{
|
||||||
Write-Host "Green container is not running. Starting green container."
|
Write-Host "Green container is not running. Starting green container."
|
||||||
|
|||||||
Reference in New Issue
Block a user