Skip to content

feat: run scheduled task ASAP if start is missed#185

Open
robotnikz wants to merge 1 commit into
mainfrom
feat/issue-181-run-on-missed
Open

feat: run scheduled task ASAP if start is missed#185
robotnikz wants to merge 1 commit into
mainfrom
feat/issue-181-run-on-missed

Conversation

@robotnikz
Copy link
Copy Markdown
Owner

Closes #181

Summary

  • Adds a "Run as soon as possible if start is missed" checkbox to the schedule UI, visible when the Windows Task Scheduler backend is selected
  • When enabled, WinBorg patches the created task via PowerShell to set StartWhenAvailable = true — equivalent to the identically named option in the Windows Task Scheduler GUI
  • The PowerShell patch runs after successful schtasks /Create; a failure to patch is logged as a warning but does not fail the overall task creation
  • Fully backwards compatible — existing jobs without scheduleRunIfMissed behave as before

Changes

File What changed
src/types.ts scheduleRunIfMissed?: boolean added to BackupJob
main/windowsTaskScheduler.js buildPatchStartWhenAvailableArgs() + PowerShell call in upsertJob
src/components/JobsModal.tsx Checkbox in Windows Task Scheduler section + state wiring
src/test/windowsTaskScheduler.test.ts 3 new tests (args shape, PowerShell called when true, not called when false)

Test plan

  • Create a Windows Task Scheduler job with the new checkbox enabled — verify the task in Windows Task Scheduler UI shows "Run task as soon as possible after a scheduled start is missed" checked
  • Create a job with the checkbox disabled — verify the setting is absent
  • Set the PC clock past a scheduled time without running — turn the option on, reboot, verify the backup runs on startup
  • All 263 unit tests pass

Adds a "Run as soon as possible if start is missed" option to the
Windows Task Scheduler backend. When enabled, WinBorg patches the task
after creation via PowerShell to set StartWhenAvailable = true, so
Windows catches up on any backup that was skipped while the PC was off.
@robotnikz robotnikz force-pushed the feat/issue-181-run-on-missed branch from f03c9a6 to fe750b6 Compare May 16, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Enable "Run task as soon as possible after a scheduled start is missed" in Windows Task Scheduler

1 participant