| # μλ² μλ μ¬μμ μ€ν¬λ¦½νΈ | |
| $ErrorActionPreference = "Continue" | |
| $scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| Set-Location $scriptPath | |
| function Start-Server { | |
| Write-Host "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] μλ² μμ μ€..." -ForegroundColor Green | |
| $process = Start-Process -FilePath "python" -ArgumentList "run.py" -PassThru -NoNewWindow -Wait | |
| if ($process.ExitCode -ne 0) { | |
| Write-Host "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] μλ²κ° μ’ λ£λμμ΅λλ€. 5μ΄ ν μ¬μμν©λλ€..." -ForegroundColor Yellow | |
| Start-Sleep -Seconds 5 | |
| Start-Server | |
| } | |
| } | |
| # 무ν 루νλ‘ μλ² μ€ν | |
| while ($true) { | |
| try { | |
| Start-Server | |
| } | |
| catch { | |
| Write-Host "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] μ€λ₯ λ°μ: $_" -ForegroundColor Red | |
| Write-Host "5μ΄ ν μ¬μμν©λλ€..." -ForegroundColor Yellow | |
| Start-Sleep -Seconds 5 | |
| } | |
| } | |