svc

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 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 installs and controls flockd as a per-user OS service: launchd LaunchAgent (macOS), systemd --user unit (Linux) and a Task Scheduler logon task (Windows). `tera up|down|uninstall` drive this.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("svc: service management not implemented on this platform")

ErrUnsupported marks platforms whose integration is still a stub.

Functions

func Linger added in v0.9.4

func Linger(ctx context.Context) (user string, on, known, applies bool)

Linger reports whether systemd lingering is enabled for the current user: without it the --user unit, and the node with it, stops when the last session ends. It only reads; `tera up` is what enables lingering. known is false when the answer could not be read (no loginctl, not a systemd session). applies is always true on Linux.

Types

type Manager

type Manager interface {
	// Install writes the service definition pointing at binPath with args.
	Install(ctx context.Context, binPath string, args []string, opts Options) error
	Uninstall(ctx context.Context) error
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Status(ctx context.Context) (Status, error)
}

Manager is the platform-specific service controller.

func NewManager

func NewManager() Manager

NewManager returns the manager for the current OS (svc_*.go).

type Options

type Options struct {
	// LogPath receives the daemon's stdout+stderr where the platform has no
	// native log sink (launchd; on Windows it becomes flockd --log-file).
	// systemd ignores it — journalctl already captures the unit's output.
	LogPath string
	// Notice receives non-fatal, operator-facing notes from Install
	// (e.g. Linux lingering). Warn is for things the operator should act
	// on; Info for confirmations. Either may be nil.
	Warn func(msg string)
	Info func(msg string)
}

Options tune the installed service definition.

type Status

type Status string

Status of the managed service.

const (
	StatusRunning      Status = "running"
	StatusStopped      Status = "stopped"
	StatusNotInstalled Status = "not-installed"
	StatusUnknown      Status = "unknown"
)

Jump to

Keyboard shortcuts

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