Deterministic, operator‑grade scheduling and environment management utilities for Linux (systemd + cron).
Suite: Linktech Engineering Tools Suite
Project: TaskScheduler
Maintainer: Leon McClatchey, Linktech Engineering LLC
License: MIT (source) · Proprietary (binaries, if distributed)
Requires: Python 3.12+
Status: Active Development (Phase 2)
- Overview
- Architectural Invariants
- Systemd Unit Model
- Unit Discovery
- Parsing Rules
- Environment Resolution
- Timer Semantics
- Modification Rules
- Editor Contract
- Orchestration
- Future Extensions
- Deterministic Guarantees
TaskScheduler’s systemd subsystem provides deterministic discovery, parsing, environment resolution, and safe modification of systemd units and timers. It does not implement or interact with the full init system — only the components required for scheduling and environment management:
- Timer units
- Service units
- Drop‑ins
- Environment sources
- Reload semantics
The subsystem is designed to be reproducible, predictable, and safe for operators. All write‑back operations occur through drop‑ins, never through modification of system units.
These invariants define the behavior of the systemd subsystem. They do not change across versions.
- Timer → Service Mapping Every timer unit maps to exactly one service unit.
- Drop‑in Override Model Drop‑ins override base units but never replace them.
- Environment Precedence
EnvironmentFile=overridesEnvironment=. Drop‑ins override both. - Write‑back Safety TaskScheduler never writes to system units directly. Only drop‑ins are generated.
- Comment Preservation All comments and ordering in unit files must be preserved.
- Reload Requirement Any modification requires a deterministic reload sequence.
- Deterministic Discovery Unit discovery must produce identical results across runs.
TaskScheduler defines a strict internal model for systemd units.
Represents any unit file.
Fields include:
namepathtype(service, timer, etc.)sectionsdirectivescommentsdropins
Specialization of SystemdUnit for service units.
Additional fields:
exec_startenvironmentenvironment_filesdropins
Specialization of SystemdUnit for timer units.
Additional fields:
on_calendaraccuracy_secrandomized_delay_secpersistentunit_target
Represents a drop‑in override file.
Fields:
pathsectionsdirectivescomments
Represents any environment source:
Environment=EnvironmentFile=- drop‑ins
- resolved file contents
TaskScheduler performs deterministic discovery of systemd units.
/etc/systemd/system/usr/lib/systemd/system/run/systemd/system- Drop‑ins under
*.d/directories
- Timer units are paired with their corresponding service units.
- Drop‑ins are attached to their parent units.
- Environment files referenced by units are resolved.
- All discovered units are normalized into the internal model.
Discovery must produce identical results across runs unless the underlying filesystem changes.
Parsing is deterministic and comment‑preserving.
- Sections are parsed in order.
- Directives are parsed exactly as written.
- Comments are preserved with positional fidelity.
- Duplicate directives are allowed and preserved.
Environment=lines are parsed into key/value pairs.EnvironmentFile=paths are resolved and parsed.- Drop‑ins override base unit values.
- Drop‑ins are parsed identically to unit files.
- Drop‑ins override base unit directives.
- Ordering is preserved.
TaskScheduler resolves environment variables from all systemd sources.
Environment=EnvironmentFile=- Drop‑ins
- Resolved file contents
- Drop‑ins
- EnvironmentFile
- Environment
Each variable is classified as:
- active
- inherited
- overridden
- shadowed
- masked
These statuses feed directly into the Environment Table.
TaskScheduler interprets systemd timer directives into its internal schedule model.
OnCalendar=AccuracySec=RandomizedDelaySec=Persistent=
OnCalendar=→ canonical schedule expressionAccuracySec=→ schedule toleranceRandomizedDelaySec=→ jitter modelPersistent=→ missed‑run behavior
Timer activation is mapped to the corresponding service unit.
Modification is performed exclusively through drop‑ins.
Environment=EnvironmentFile=- Timer directives
- Service directives
- Any overrideable directive
- Unit type
- Unit name
- Unit path
- System‑provided directives
- Drop‑ins are generated deterministically.
- Comments and ordering are preserved.
- Only modified fields are written.
- Reload is triggered after write‑back.
Defines how the systemd editor behaves.
- Timer fields
- Service fields
- Environment fields
- Drop‑in fields
- Directive validation
- Environment key/value validation
- File path validation
- Only changed fields generate drop‑ins.
- Write‑back is atomic.
- Reload is deterministic.
- Parse errors
- Write‑back errors
- Reload errors
Defines how systemd integrates with the rest of TaskScheduler.
- Timer table
- Service table
- Environment table
- Editor routing
- Refresh cycles
- Environment propagation
Defines how cron schedules can be migrated into systemd timers.
Reserved for future development:
- systemd‑user units
- transient units
- advanced environment layering
- unit templating
- multi‑instance services
TaskScheduler provides the following guarantees:
- deterministic parsing
- deterministic write‑back
- deterministic environment resolution
- deterministic override behavior
- deterministic reload semantics
- deterministic discovery
These guarantees define the reliability and reproducibility of the systemd subsystem.