service

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(u *Unit) error

Create writes a systemd unit file and reloads the daemon.

func Exists added in v1.4.0

func Exists(name string) bool

Exists checks if a systemd unit file exists.

func GetUser added in v1.6.2

func GetUser(name string) string

GetUser returns the User= value from a service's unit file.

func ListSlipgateServices added in v1.5.0

func ListSlipgateServices() []string

ListSlipgateServices returns the names of all slipgate-* service files found in the systemd directory (without the .service suffix).

func Logs

func Logs(name string, lines string) (string, error)

Logs returns recent log lines for a service.

func ReadUnitFile added in v1.6.3

func ReadUnitFile(name string) string

ReadUnitFile returns the raw unit file contents, or empty string if absent.

func Reload added in v1.6.3

func Reload(name string) error

Reload asks systemd to run the service's ExecReload (typically sending SIGHUP to the main pid). Does not drop live connections.

func Remove

func Remove(name string) error

Remove removes a service unit file. Silently skips if it doesn't exist.

func Restart

func Restart(name string) error

Restart restarts a service.

func Start

func Start(name string) error

Start enables and starts a service.

func Status

func Status(name string) (string, error)

Status returns the active state of a service.

func Stop

func Stop(name string) error

Stop stops and disables a service. Silently skips if the service doesn't exist.

func TunnelServiceName

func TunnelServiceName(tag string) string

TunnelServiceName returns the systemd service name for a tunnel.

Types

type Unit

type Unit struct {
	Name        string
	Description string
	ExecStart   string
	ExecReload  string
	User        string
	Group       string
	After       string
	Restart     string
	WorkingDir  string
	Environment []string
}

Unit represents a systemd unit file.

Jump to

Keyboard shortcuts

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