[2026-05-15] 작업 스케줄러 자동화 + main.py 타이밍 수정
- scripts/run_morning.ps1: claude_morning 실행 스크립트 - scripts/run_bot.bat: 매매봇 실행 스크립트 - scripts/setup_scheduler.ps1: 작업 스케줄러 등록 스크립트 - app/main.py: AI 컨텍스트 로드 타이밍 08:05→08:30으로 수정 (claude_morning이 08:15 시작해 08:30 전에 완료되므로) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# StockBot 작업 스케줄러 등록
|
||||
# 관리자 권한 없이도 현재 사용자 계정으로 등록 가능
|
||||
|
||||
$PROJECT = "C:\Users\whdwo\OneDrive\바탕 화면\stockbot_v3"
|
||||
|
||||
# ── 평일(월~금) 트리거 ──────────────────────────────────────────────────────
|
||||
$weekdays = @(
|
||||
[DayOfWeek]::Monday,
|
||||
[DayOfWeek]::Tuesday,
|
||||
[DayOfWeek]::Wednesday,
|
||||
[DayOfWeek]::Thursday,
|
||||
[DayOfWeek]::Friday
|
||||
)
|
||||
|
||||
# ── Task 1: claude_morning (08:15, 평일) ────────────────────────────────────
|
||||
$morningTrigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek $weekdays -At "08:15"
|
||||
$morningAction = New-ScheduledTaskAction `
|
||||
-Execute "powershell.exe" `
|
||||
-Argument "-NonInteractive -ExecutionPolicy Bypass -File `"$PROJECT\scripts\run_morning.ps1`"" `
|
||||
-WorkingDirectory $PROJECT
|
||||
$morningSettings = New-ScheduledTaskSettingsSet `
|
||||
-ExecutionTimeLimit (New-TimeSpan -Minutes 20) `
|
||||
-StartWhenAvailable
|
||||
|
||||
Register-ScheduledTask `
|
||||
-TaskName "StockBot_Morning" `
|
||||
-TaskPath "\StockBot\" `
|
||||
-Trigger $morningTrigger `
|
||||
-Action $morningAction `
|
||||
-Settings $morningSettings `
|
||||
-RunLevel Limited `
|
||||
-Force
|
||||
|
||||
Write-Host "[OK] StockBot_Morning 등록 완료 (평일 08:15)" -ForegroundColor Green
|
||||
|
||||
# ── Task 2: 매매봇 (07:55, 평일) ────────────────────────────────────────────
|
||||
$botTrigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek $weekdays -At "07:55"
|
||||
$botAction = New-ScheduledTaskAction `
|
||||
-Execute "cmd.exe" `
|
||||
-Argument "/c `"$PROJECT\scripts\run_bot.bat`"" `
|
||||
-WorkingDirectory $PROJECT
|
||||
$botSettings = New-ScheduledTaskSettingsSet `
|
||||
-ExecutionTimeLimit (New-TimeSpan -Hours 8) `
|
||||
-StartWhenAvailable
|
||||
|
||||
Register-ScheduledTask `
|
||||
-TaskName "StockBot_Bot" `
|
||||
-TaskPath "\StockBot\" `
|
||||
-Trigger $botTrigger `
|
||||
-Action $botAction `
|
||||
-Settings $botSettings `
|
||||
-RunLevel Limited `
|
||||
-Force
|
||||
|
||||
Write-Host "[OK] StockBot_Bot 등록 완료 (평일 07:55)" -ForegroundColor Green
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "등록된 작업 확인:" -ForegroundColor Cyan
|
||||
Get-ScheduledTask -TaskPath "\StockBot\" | Select-Object TaskName, State
|
||||
Reference in New Issue
Block a user