feat(scripts): windows scheduled task for auto-run at logon

This commit is contained in:
beo3000 2026-06-15 17:44:17 +02:00
parent 39a02d8fdd
commit cf2a6614f9
2 changed files with 21 additions and 0 deletions

14
scripts/install-task.ps1 Normal file
View File

@ -0,0 +1,14 @@
# Registers a Windows Task Scheduler task that runs journal_bot at user logon.
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
-Argument "-NoProfile -ExecutionPolicy Bypass -File `"$root\scripts\run.ps1`" both"
$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopOnIdleEnd `
-RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 5)
$principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive
Register-ScheduledTask -TaskName "JournalBot" -Action $action -Trigger $trigger `
-Settings $settings -Principal $principal -Force
Write-Host "Task 'JournalBot' registered. Runs at user logon."

7
scripts/run.ps1 Normal file
View File

@ -0,0 +1,7 @@
# Wrapper: aktiviert venv und führt journal_bot aus.
# Usage: run.ps1 [ingest|process|both]
param([string]$Cmd = "both")
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
Set-Location $root
& "$root\.venv\Scripts\python.exe" -m journal_bot $Cmd