c4ac27b5ac
- ~/.claude/commands/start-bot.md: /start-bot 슬래시 커맨드 추가 (DETACHED_PROCESS로 Python 봇 백그라운드 실행 + Discord 알림) - scripts/run_bot.ps1: python 직접 실행 → claude -p "/start-bot" 로 변경 - scripts/setup_scheduler.ps1: 3개 태스크 통합 재등록 스크립트 업데이트 - StockBot_Bot 태스크 업데이트 완료 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.8 KiB
PowerShell
37 lines
1.8 KiB
PowerShell
# StockBot 작업 스케줄러 등록 (전체 재등록용)
|
|
# 실행: powershell -ExecutionPolicy Bypass -File scripts\setup_scheduler.ps1
|
|
|
|
$PROJECT = "C:\Users\whdwo\OneDrive\바탕 화면\stockbot_v3"
|
|
$weekdays = @(
|
|
[DayOfWeek]::Monday, [DayOfWeek]::Tuesday, [DayOfWeek]::Wednesday,
|
|
[DayOfWeek]::Thursday, [DayOfWeek]::Friday
|
|
)
|
|
|
|
function Register-StockTask($name, $time, $script, $limitMin) {
|
|
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek $weekdays -At $time
|
|
$action = New-ScheduledTaskAction `
|
|
-Execute "powershell.exe" `
|
|
-Argument "-NonInteractive -ExecutionPolicy Bypass -File `"$PROJECT\scripts\$script`"" `
|
|
-WorkingDirectory $PROJECT
|
|
$settings = New-ScheduledTaskSettingsSet `
|
|
-ExecutionTimeLimit (New-TimeSpan -Minutes $limitMin) `
|
|
-StartWhenAvailable
|
|
Register-ScheduledTask -TaskName $name -TaskPath "\StockBot\" `
|
|
-Trigger $trigger -Action $action -Settings $settings -RunLevel Limited -Force
|
|
Write-Host "[OK] $name 등록 완료 (평일 $time)" -ForegroundColor Green
|
|
}
|
|
|
|
# ── 3개 태스크 등록 ──────────────────────────────────────────────────────────
|
|
# 07:55 claude /start-bot → Python 봇 백그라운드 시작
|
|
Register-StockTask "StockBot_Bot" "07:55" "run_bot.ps1" 10
|
|
|
|
# 08:15 claude /morning → 뉴스+KIS 수집 → daily_context.json
|
|
Register-StockTask "StockBot_Morning" "08:15" "run_morning.ps1" 20
|
|
|
|
# 15:30 claude /evening → 결과 분석 → 리포트 → Discord
|
|
Register-StockTask "StockBot_Evening" "15:30" "run_evening.ps1" 30
|
|
|
|
Write-Host ""
|
|
Write-Host "등록된 작업:" -ForegroundColor Cyan
|
|
Get-ScheduledTask -TaskPath "\StockBot\" | Format-Table TaskName, State
|