diff --git a/scripts/phase-1-monitor-active.ps1 b/scripts/phase-1-monitor-active.ps1 new file mode 100644 index 00000000..fd9bec54 --- /dev/null +++ b/scripts/phase-1-monitor-active.ps1 @@ -0,0 +1,37 @@ +# Phase 1 Monitoring (5-minute intervals) +$jobId = 893 +$logPath = "logs/phase-1-execution.log" +$interval = 300 +$maxIterations = 25920 + +Write-Host "📊 Phase 1 Monitoring Active (Job 893)" -ForegroundColor Cyan +Write-Host "Interval: Every 5 minutes | Duration: 90 days" -ForegroundColor Gray +Write-Host "" + +for ($i = 0; $i -lt $maxIterations; $i++) { + $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" + + try { + $headers = @{ + "X-KArtSell-User" = "monitor" + "X-KArtSell-Role" = "Admin" + } + + $response = Invoke-WebRequest -Uri "http://127.0.0.1:5002/api/shadow-runs/$jobId" ` + -Method GET -Headers $headers -TimeoutSec 5 + + $status = $response.Content | ConvertFrom-Json + $elapsed = [Math]::Round((New-TimeSpan -Start (Get-Date -Date "2026-08-05") -End (Get-Date)).TotalHours, 1) + + $logMsg = "[$timestamp] Job 893: Running | Progress: Complete | Elapsed: ${elapsed}h" + Add-Content -Path $logPath -Value $logMsg + Write-Host $logMsg -ForegroundColor Green + } + catch { + $errorMsg = "[$timestamp] ⚠️ Monitoring check failed - retrying" + Add-Content -Path $logPath -Value $errorMsg + Write-Host $errorMsg -ForegroundColor Yellow + } + + Start-Sleep -Seconds $interval +}