service

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package service handles host service installation: launchd on macOS, systemd user units on Linux. Used by `dejima service install/uninstall`.

Package service handles installing dejimad as a host service (launchd on macOS, systemd user units on Linux). The CLI's `dejima service install` command is a thin wrapper over this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is install, uninstall, status, etc.

const (
	ActionInstall   Action = "install"
	ActionUninstall Action = "uninstall"
	ActionStatus    Action = "status"
)

type Manager

type Manager interface {
	// Install registers dejimad with the host service manager. args are the
	// extra command-line arguments baked into the service definition (e.g.
	// ["--tcp", ":7273"] to expose the Tailscale-pinned TCP listener).
	Install(binaryPath string, args []string) error
	Uninstall() error
	Status() (string, error)
	// Restart bounces the running daemon (e.g. after `make install` or a
	// release upgrade replaced the binary).
	Restart() error
}

Manager is the OS-specific service manager.

func New

func New(system bool) (Manager, error)

New returns a Manager appropriate for the current OS. With system=true on macOS it manages a system-wide LaunchDaemon instead of a per-user LaunchAgent — that's the reboot-durable option for headless Macs, where the gui launchd domain (which LaunchAgents need) never exists.

type Supervision

type Supervision struct {
	Managed       bool   // a service manager currently has dejimad loaded
	Mode          string // launchd-system | launchd-gui | launchd-user | systemd-user | none | unknown
	RebootDurable bool   // comes back after a reboot with no interactive login
	Summary       string // human one-liner for the report row
	Concern       string // non-empty → a reboot-survival caveat worth a WARN
}

Supervision describes how (and whether) dejimad is supervised by the host service manager, and whether that arrangement survives a reboot. It answers the question `dejima doctor` couldn't before: not just "is the daemon up?" but "will it come back on its own?".

func Detect

func Detect() Supervision

Detect inspects the host service manager for a dejimad supervision arrangement. Best-effort: never errors; returns Mode "none" when nothing is found and "unknown" on an unsupported OS.

Jump to

Keyboard shortcuts

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