feat(scripts): windows scheduled task for auto-run at logon
This commit is contained in:
parent
39a02d8fdd
commit
cf2a6614f9
|
|
@ -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."
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue