File size: 970 Bytes
9d377df 9fa456d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# μλ² μλ μ¬μμ μ€ν¬λ¦½νΈ
$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
}
}
|