winunitd

module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT

README

winunitd

Run Windows background applications from declarative unit files. winunitd starts processes in dependency order, owns their process trees, captures output, and restarts workloads when they fail.

It borrows unit files and familiar commands from systemd, using Windows services, Job Objects, and named pipes underneath. It is not a systemd compatibility layer. See the unit reference for the supported syntax.

Download 0.5.1 for Windows 11 Enterprise and Enterprise LTSC x64. No Go or .NET runtime is needed on the destination. The MSI is not code-signed yet; check it against the release's SHA256SUMS and its build attestation as the release notes describe.

Install and try it

Run the MSI from an elevated PowerShell terminal in your download directory:

msiexec.exe /i .\winunitd-0.5.1-x64.msi /qb

It starts the LocalSystem winunitd service, installs the commands under C:\Program Files\winunitd\bin and adds that folder to PATH. Open a new elevated terminal so that winctl is found. System units run with SYSTEM privileges; keep their files administrator-controlled. No example workload is enabled.

Try the included worker, which prints a line every five seconds:

$examples = Join-Path $env:ProgramFiles 'winunitd\doc\examples'
$units = Join-Path $env:ProgramData 'winunitd\units'

winctl verify --file "$examples\worker.service" "$examples\worker.target"
Copy-Item "$examples\worker.service", "$examples\worker.target" $units
winctl daemon-reload
winctl start worker.target
winctl status worker.service
winctl logs worker.service

The example assumes Windows is installed at C:\Windows. Allow a few seconds for the worker's first output. To restart the group or stop it:

winctl restart worker.target
winctl stop worker.target

Use winctl enable worker.service to start the worker whenever the daemon starts. disable removes that future activation; it does not stop a running workload. Unit files live under C:\ProgramData\winunitd\units; logs and enablement are stored alongside them. See the unit reference to configure your own applications.

What it supports

The system manager runs services, oneshots and targets with dependencies, start/stop/restart including a cooperative stop command, captured logs, configuration reload, explicit enablement, restart policies with backoff, readiness and health probes, and timers. Admitted users get their own manager for units under %LOCALAPPDATA%\winunitd, and winctl enable-linger keeps a user's manager running without a sign-in, for local and Active Directory domain accounts. Go programs can drive the managers through the client package.

SUPPORT.md lists the supported configurations and the limits, and runtime behavior, operations and user admission cover the details.

Upgrade, repair, and uninstall

Run a newer MSI to upgrade. The installer asks the running manager to quiesce, stops the service, replaces the files and starts it again; if that fails it restores the previous files and service state. Enabled units start again after an upgrade. Uninstall keeps C:\ProgramData\winunitd, and a reinstall reuses it. Downgrades are refused.

Coming from the unsigned 0.2.1-beta, remove the beta first; units, enablement and logs carry over (moving from the beta). The installation guide covers repair, removal, exit codes and the compatibility floor. Do not run winunitd install or winunitd uninstall against an MSI installation.

Build and contribute

The project is written in Go and licensed under MIT. The binaries are:

Binary Purpose
winunitd.exe Loads units and supervises processes
winctl.exe Controls the manager and reads status/logs
winunit-notify.exe Reports readiness, status, and watchdog heartbeats

Use the Go version in .go-version. From a Windows checkout:

go test ./...
go run ./tools/build -out dist

Build the MSI from clean source with ./packaging/wix/build.ps1. Published releases come from the release workflow instead. BUILDING.md covers the pinned toolchain, manifests, CI, releases, and dependency maintenance. Unstamped development binaries retain the 0.5.1 fallback label; the manifest records their exact source revision.

For help and the supported configurations see SUPPORT.md; report vulnerabilities privately as described in SECURITY.md.

The roadmap, design, and milestones describe future work. Proposed design semantics are not the current unit-file contract. The architecture review and the release notes for 0.5.1, 0.5.0, 0.4.0 and 0.3.0 provide further background.

This GitHub repository was recreated on October 14, 2026. The Git history, tags, and releases carried over unchanged. Issue and pull request numbers up to #300 in older commit messages and documents refer to the original repository, whose discussions are no longer public. Its open issues and draft pull request continue here as #1 to #9.

Directories

Path Synopsis
Package client talks to winunitd's control pipes from Go.
Package client talks to winunitd's control pipes from Go.
cmd
winctl command
winunit-notify command
winunitd command
internal
capability
Package capability lists the contract names a winunitd build enforces.
Package capability lists the contract names a winunitd build enforces.
core
Package core contains the dependency graph and unit state machine.
Package core contains the dependency graph and unit state machine.
eventlog
Package eventlog parses EventLogTrigger= values and subscribes to Windows Event Log channels.
Package eventlog parses EventLogTrigger= values and subscribes to Windows Event Log channels.
journal
Package journal stores structured unit logs (DESIGN.md §22, §24).
Package journal stores structured unit logs (DESIGN.md §22, §24).
manager
Package manager is the in-process unit manager used by winunitd.
Package manager is the in-process unit manager used by winunitd.
notify
Package notify is the native readiness/watchdog protocol (DESIGN.md §9, §19.1, §79–80).
Package notify is the native readiness/watchdog protocol (DESIGN.md §9, §19.1, §79–80).
pathwatch
Package pathwatch parses PathChanged= / PathExists= values and watches files/directories.
Package pathwatch parses PathChanged= / PathExists= values and watches files/directories.
protocol
Package protocol is the versioned JSON-RPC control API for winunitd.
Package protocol is the versioned JSON-RPC control API for winunitd.
registry
Package registry parses RegistryChanged= hive paths and watches keys.
Package registry parses RegistryChanged= hive paths and watches keys.
runtime
Package runtime contains the Windows Service host, the daemon-level Job Object used for strict ownership, per-unit Job Objects (including R1 MemoryMax=/ProcessLimit=/PriorityClass= and R2 CPUWeight=/CPUQuota=/ IoPriority=), CreateProcess supervision, WTS tokens, S4U linger tokens, user-manager process launch, and the Type=scm SCM proxy client (StartService / StopService / QueryServiceStatusEx; never CreateService / ChangeServiceConfig / Delete), and the Type=scheduled-task Task Scheduler proxy client (IRegisteredTask.Run / Stop / State; never RegisterTask / DeleteTask / put_Enabled).
Package runtime contains the Windows Service host, the daemon-level Job Object used for strict ownership, per-unit Job Objects (including R1 MemoryMax=/ProcessLimit=/PriorityClass= and R2 CPUWeight=/CPUQuota=/ IoPriority=), CreateProcess supervision, WTS tokens, S4U linger tokens, user-manager process launch, and the Type=scm SCM proxy client (StartService / StopService / QueryServiceStatusEx; never CreateService / ChangeServiceConfig / Delete), and the Type=scheduled-task Task Scheduler proxy client (IRegisteredTask.Run / Stop / State; never RegisterTask / DeleteTask / put_Enabled).
runtime/runtimetest/nestedjob
Package nestedjob is the test-only workload fixture for issue #265.
Package nestedjob is the test-only workload fixture for issue #265.
servicing
Package servicing holds the compatibility floor: the minimum build that may admit hosted work on a machine.
Package servicing holds the compatibility floor: the minimum build that may admit hosted work on a machine.
servicing/servicingtest
Package servicingtest prepares compatibility-floor directories for tests: fresh directories protected the way the product's data root is, so the floor store trusts them on every system.
Package servicingtest prepares compatibility-floor directories for tests: fresh directories protected the way the product's data root is, so the floor store trusts them on every system.
timers
Package timers contains calendar expression parsing and monotonic scheduling.
Package timers contains calendar expression parsing and monotonic scheduling.
unit
Package unit parses and verifies systemd-like INI unit files.
Package unit parses and verifies systemd-like INI unit files.
version
Package version is the winunitd / winctl release string.
Package version is the winunitd / winctl release string.
winevt
Package winevt is the Windows Application event channel for daemon lifecycle and startup failures.
Package winevt is the Windows Application event channel for daemon lifecycle and startup failures.
tests
native/nested-job command
Command nested-job-fixture is the standalone workload fixture for installed-daemon qualification of workload-created nested jobs (#265).
Command nested-job-fixture is the standalone workload fixture for installed-daemon qualification of workload-created nested jobs (#265).
tools
build command
Command build creates pinned, path-trimmed binaries and a public-safe manifest.
Command build creates pinned, path-trimmed binaries and a public-safe manifest.
lab command
Command lab controls only an explicitly configured private qualification pool.
Command lab controls only an explicitly configured private qualification pool.
migrate command
Command migrate is the R6.5 operator migration tool.
Command migrate is the R6.5 operator migration tool.
msi-check command
msi-fixture command
Command msi-fixture is a disposable-lab service, never the product daemon.
Command msi-fixture is a disposable-lab service, never the product daemon.
package-identity command
Command package-identity checks, before an MSI is built, that the package helper and the payload binaries are one build: the same source revision, unmodified tree, toolchain and target, read from the produced binaries' embedded build information, and the same release value, read from the version variable linked into each binary that has one.
Command package-identity checks, before an MSI is built, that the package helper and the payload binaries are one build: the same source revision, unmodified tree, toolchain and target, read from the produced binaries' embedded build information, and the same release value, read from the version variable linked into each binary that has one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL