svc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 7 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 svc wraps `systemctl --user` and `journalctl --user`.

Index

Constants

View Source
const ExitRadioMissing = 3

ExitRadioMissing is the exit status of a hamstack service whose radio is not there (hamstack's units list it in RestartPreventExitStatus, so there is no restart loop).

Variables

This section is empty.

Functions

func Available

func Available() error

Available reports whether a systemd user manager is reachable.

func LingerEnabled

func LingerEnabled() (bool, error)

LingerEnabled reports whether the current user's services keep running (and start at boot) without an open login session.

func Logs

func Logs(unit string, follow bool, lines int) error

Logs streams the journal for a unit to stdout.

func LogsText

func LogsText(unit string, lines int) (string, error)

LogsText returns the last lines of a unit's journal.

func Run

func Run(verb string, units ...string) error

Run executes a systemctl verb (start, stop, restart, enable, disable, daemon-reload) on units.

func SetLinger

func SetLinger(on bool) error

SetLinger turns lingering on or off for the current user. It first tries without privileges (polkit allows a user to manage their own), then with sudo.

Types

type State

type State struct {
	Load    string // loaded, not-found
	Active  string // active, inactive, failed, activating...
	Sub     string // running, dead, failed...
	Enabled string // enabled, disabled, static, ...
	Since   string // ActiveEnterTimestamp, empty if never
	// ExitStatus is the exit code of the service's main process the last time it ran.
	ExitStatus int
}

State is a unit's runtime state.

func Status

func Status(unit string) State

Status returns the state of one unit.

func (State) Display

func (s State) Display() string

Display is the state as a person should read it.

func (State) NoRadio

func (s State) NoRadio() bool

NoRadio reports a service that stopped because its radio, receiver or sound card is not plugged in: that is waiting for hardware, not a fault in the service.

Jump to

Keyboard shortcuts

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