From cf2a6614f949d8b4600c3636d0f19fa54889b364 Mon Sep 17 00:00:00 2001 From: beo3000 Date: Mon, 15 Jun 2026 17:44:17 +0200 Subject: [PATCH] feat(scripts): windows scheduled task for auto-run at logon --- scripts/install-task.ps1 | 14 ++++++++++++++ scripts/run.ps1 | 7 +++++++ 2 files changed, 21 insertions(+) create mode 100644 scripts/install-task.ps1 create mode 100644 scripts/run.ps1 diff --git a/scripts/install-task.ps1 b/scripts/install-task.ps1 new file mode 100644 index 0000000..219e7a5 --- /dev/null +++ b/scripts/install-task.ps1 @@ -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." diff --git a/scripts/run.ps1 b/scripts/run.ps1 new file mode 100644 index 0000000..1c50ae0 --- /dev/null +++ b/scripts/run.ps1 @@ -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