Documentation
¶
Overview ¶
Package schedinfo gathers and logs the agent's own scheduler state — launchd on macOS, Task Scheduler on Windows, systemd on Linux — for troubleshooting. It answers "did the agent run, when, how often, and how is it scheduled?" from inside agent.log, so an operator no longer has to reproduce `launchctl print` / `schtasks /query /v` by hand (the manual recipes live in docs/launchd-troubleshooting.md).
Every gather path is best-effort: short per-command timeouts, failures recorded in Info.Warnings, and Gather never returns an error — a flaky launchctl/schtasks/systemctl call can't fail a scan. The pure parse helpers live in this (untagged) file so they compile and unit-test on any OS; the platform files only orchestrate the subprocess calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Info ¶
type Info struct {
Platform string // runtime.GOOS
Manager string // "launchd" | "schtasks" | "systemd" | ""
Scheduled bool // a scheduler footprint exists on disk
Loaded bool // the scheduler currently knows the job
Management Management // loader vs binary vs unknown
Label string // launchd label / windows task name / systemd unit
UnitPath string // plist / unit path ("" on windows)
State string // launchd "state" / schtasks "Status"
IntervalSeconds int // schedule interval (0 = unknown)
ConfiguredHours int // config.ScanFrequencyHours (cross-check)
RunAtLoad *bool // macOS only; nil elsewhere
LastRunTime string // human-readable last-run
LastExitCode *int // launchd "last exit code" / windows "Last Result"
NextRunTime string // windows "Next Run Time"; "" where unavailable
MissedRuns *int // windows "Number of Missed Runs"; nil elsewhere
PID *int // running PID when in-flight
LogMtime time.Time // mtime of <Home>/agent.log as a last-run proxy
Raw string // raw command output, logged at Debug
Warnings []string // per-query failures / drift notes, logged at Warn
}
Info is a best-effort snapshot of the agent's scheduler state. Empty strings / zero ints mean "unknown"; pointer fields are nil when the value could not be determined (distinct from a real zero).
type Management ¶
type Management string
Management classifies who owns the scheduler entry, inferred from the program the plist/task invokes.
const ( ManagementUnknown Management = "unknown" ManagementLoader Management = "loader" // runs stepsecurity-loader.{sh,ps1} ManagementBinary Management = "binary" // runs the agent binary directly )