schedinfo

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Log

func Log(info Info, log *progress.Logger)

Log emits info's headline fields at Progress, the raw command dump at Debug, and any warnings at Warn. Safe to call with a zero Info.

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).

func Gather

func Gather(ctx context.Context, exec executor.Executor) Info

Gather collects scheduler state for the current platform. Best-effort; never returns an error.

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
)

Jump to

Keyboard shortcuts

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