Last active
November 30, 2022 15:02
-
-
Save sitefinitySDK/48a06fc10a4680aea6ec to your computer and use it in GitHub Desktop.
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/application-status-page-in-continuous-integration-scenarios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$url="http://localhost", [String]$successOuput="SUCCESS", [Int32]$totalWaitMinutes=10) | |
$elapsed = [System.Diagnostics.Stopwatch]::StartNew() | |
$statusUrl = ($url + "/appstatus") | |
Write-Warning ("Attempt to start Sitefinity up: " + $statusUrl) | |
$retryCount = 0; | |
try | |
{ | |
Write-Warning ("Retry: " + $retryCount) | |
$retryCount++; | |
$response = Invoke-WebRequest $statusUrl -TimeoutSec 1800 -UseBasicParsing | |
if($response.StatusCode -eq 200) | |
{ | |
Write-Warning ("Sitefinity is starting ..." + $statusUrl) | |
} | |
while($response.StatusCode -eq 200) | |
{ | |
Write-Warning ("Checking Sitefinity status: " + $statusUrl) | |
Write-Warning ("Retry: " + $retryCount) | |
$retryCount++; | |
$response = Invoke-WebRequest $statusUrl -TimeoutSec 1800 -UseBasicParsing | |
if($elapsed.Elapsed.TotalMinutes > $totalWaitMinutes) | |
{ | |
Write-Warning ("Sitefinity did NOT start in the specified maximum time") | |
break | |
} | |
Start-Sleep -s 1 | |
} | |
} | |
catch | |
{ | |
if($_.Exception.Response.StatusCode.Value__ -eq 404) | |
{ | |
$response = Invoke-WebRequest $url -TimeoutSec 120 -UseBasicParsing | |
if($response.StatusCode -eq 200) | |
{ | |
Write-Warning ("Sitefinity has started after " + $elapsed.Elapsed.TotalSeconds + " second(s) - " + $successOuput) | |
} | |
else | |
{ | |
Write-Warning "Sitefinity failed to start" | |
} | |
} | |
else | |
{ | |
Write-Warning ("Sitefinity failed to start - StatusCode: " + $_.Exception.Response.StatusCode.Value__) | |
Write-Warning $_|format-list -force | |
Write-Warning $_.Exception|format-list -force | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On line 27, should it read:
instead of the current:
"Minites" isn't a property on the StopWatch object, so it is always represented as $null, so the comparison to $totalWaitMinutes (10) is always false.