Files
Stock-trading-programming/scripts/run_watchdog.ps1
T

22 lines
810 B
PowerShell
Raw Normal View History

# 워치독 스크립트 — 봇 생존 감시 + 자동 재시작
# 작업 스케줄러에서 5분마다 실행 (평일 09:00~15:10)
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$env:PYTHONIOENCODING = "utf-8"
$PROJECT = Split-Path -Parent $PSScriptRoot
$LOG = "$PROJECT\logs\watchdog.log"
$utf8 = New-Object System.Text.UTF8Encoding $false
Set-Location $PROJECT
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
[System.IO.File]::AppendAllText($LOG, "[$timestamp] 워치독 실행`n", $utf8)
python scripts/_watchdog.py 2>&1 |
ForEach-Object { [System.IO.File]::AppendAllText($LOG, "$_`n", $utf8) }
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
[System.IO.File]::AppendAllText($LOG, "[$timestamp] 워치독 완료`n", $utf8)