systemd

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutostartUserUnits added in v1.9.0

func AutostartUserUnits() []string

AutostartUserUnits returns the lerd-* systemd user units (NOT podman quadlets) that participate in "autostart at login": lerd-ui, lerd-watcher, lerd-tray, and every per-site worker/queue/schedule/ horizon/reverb/stripe service file currently present in the user's systemd/user/ directory. These can be enabled/disabled with `systemctl --user enable/disable` because they are real on-disk unit files (not generator output).

Container quadlets are NOT in this list because their auto-start behaviour is controlled by stripping the [Install] section from the .container file (see podman.StripInstallSection), not by systemctl enable/disable. The autostart toggle handles quadlets via the global config flag and a quadlet rewrite pass.

func DisableService added in v0.3.0

func DisableService(name string) error

DisableService disables a systemd user service.

func EnableService

func EnableService(name string) error

EnableService enables a systemd user service.

func GetUnit

func GetUnit(name string) (string, error)

GetUnit returns the content of an embedded systemd unit file.

func IsAutostartEnabled added in v1.9.0

func IsAutostartEnabled() bool

IsAutostartEnabled reports whether lerd is configured to come up at login. This is the inverse of cfg.Autostart.Disabled — the config flag is the canonical source of truth, not the live `systemctl is-enabled` state of any individual unit, because (a) container quadlets always report "generated" regardless of the wants symlink and (b) the flag must be readable even when no units exist on disk yet (fresh install).

func IsServiceActive added in v1.0.0

func IsServiceActive(name string) bool

IsServiceActive returns true if the systemd user service is currently active.

func IsServiceActiveOrRestarting added in v1.5.0

func IsServiceActiveOrRestarting(name string) bool

IsServiceActiveOrRestarting returns true if the service is active or in a restart loop (activating). Used to detect workers that should be stopped on unlink.

func IsServiceEnabled added in v0.3.0

func IsServiceEnabled(name string) bool

IsServiceEnabled returns true if the systemd user service is enabled.

func RestartService added in v0.6.0

func RestartService(name string) error

RestartService restarts a systemd user service.

func StartService

func StartService(name string) error

StartService starts a systemd user service.

func WriteService

func WriteService(name, content string) error

WriteService writes a systemd user service unit file.

func WriteServiceIfChanged added in v0.8.0

func WriteServiceIfChanged(name, content string) (bool, error)

WriteServiceIfChanged writes the unit file only when the content differs from what is already on disk. Returns true if the file was written (caller should run daemon-reload), false if it was unchanged (daemon-reload not needed).

Types

This section is empty.

Jump to

Keyboard shortcuts

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