Documentation
¶
Overview ¶
Package systemd installs ccswap's user service for Linux hosts.
Index ¶
Constants ¶
const Label = "ccswap.service"
Variables ¶
var ( Dir = "" RuntimeDir = func() string { return fmt.Sprintf("/run/user/%d", os.Getuid()) } User = func() string { if u, err := user.Current(); err == nil { return u.Username } return os.Getenv("USER") } Run = func(name string, args ...string) ([]byte, error) { cmd := exec.Command(name, args...) cmd.Env = runEnv() return cmd.CombinedOutput() } )
Dir is the user unit directory ("" = $XDG_CONFIG_HOME/systemd/user or ~/.config/systemd/user). Run runs systemctl/loginctl; RuntimeDir is the /run/user/<uid> seam; User is the linger user.
var ErrNoSystemd error = i18n.Err("systemd.not_found")
ErrNoSystemd: systemctl is missing, or the host was not booted with systemd.
Functions ¶
func ProgramPath ¶
ProgramPath is the binary the installed unit runs (first word of ExecStart=).
func Refresh ¶ added in v0.2.0
Refresh rewrites the installed unit as this version writes it when it runs bin, keeping its program, description, log and environment, and reports whether it did. A unit edited beyond that stays as it is. Nothing is restarted: after daemon-reload the new unit takes effect at the service's next start.
Types ¶
type LingerError ¶
type LingerError struct{ User string }
LingerError: the service is installed, only `loginctl enable-linger` failed.
func (*LingerError) Error ¶
func (e *LingerError) Error() string