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