launchd

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

launchd

Go package (package launchd) that renders parameterised macOS launchd agent definitions from a Job spec via the embedded job.plist.tmpl, and writes them to a LaunchAgents directory idempotently. The per-vault Job specs are built in install (VaultJobs); install also bootstraps them via launchctl.

See ../ARCHITECTURE.md for how this fits the install flow.

Documentation

Overview

Package launchd renders parameterised macOS launchd job definitions (plist files) and writes them to a LaunchAgents directory. It is the mechanism; callers supply the per-vault Job specs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(j Job) ([]byte, error)

Render produces the plist bytes for a job.

func WriteJobs

func WriteJobs(jobs []Job, dstDir string) ([]string, error)

WriteJobs renders each job to <dstDir>/<label>.plist, creating dstDir if needed. It returns the labels whose plist was created or changed (idempotent: unchanged files are left alone).

Types

type CalInterval

type CalInterval struct {
	Weekday, Hour, Minute int
}

CalInterval is one StartCalendarInterval entry. A field set to -1 is omitted, so {Weekday: -1, Hour: 7, Minute: 3} means "07:03 every day".

type EnvVar

type EnvVar struct {
	Key, Value string
}

EnvVar is one EnvironmentVariables entry. A slice (not a map) keeps rendering deterministic for idempotent writes.

type Job

type Job struct {
	Label      string
	Program    []string // ProgramArguments
	WorkingDir string
	EnvVars    []EnvVar
	RunAtLoad  bool
	KeepAlive  bool
	Throttle   int           // ThrottleInterval seconds; 0 omits the key
	Schedule   []CalInterval // 0 = none, 1 = single dict, >1 = array
	LogPath    string
}

Job is a single launchd agent definition.

Jump to

Keyboard shortcuts

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