daemon

package
v0.1.61 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(sys System, logFile string) error

Start writes a systemd user unit file and enables the service. logFile is the absolute path to the daemon log file.

func Status

func Status(sys System) (string, error)

Status returns "running", "stopped", or "not installed".

func Stop

func Stop(sys System) error

Stop disables and stops the systemd user service and removes the unit file.

Types

type RealSystem

type RealSystem struct{}

RealSystem implements System with real OS calls.

func (RealSystem) Executable

func (RealSystem) Executable() (string, error)

func (RealSystem) MkdirAll

func (RealSystem) MkdirAll(path string, perm os.FileMode) error

func (RealSystem) RemoveFile

func (RealSystem) RemoveFile(name string) error

func (RealSystem) RunCommand

func (RealSystem) RunCommand(name string, args ...string) ([]byte, error)

func (RealSystem) Stat

func (RealSystem) Stat(name string) (os.FileInfo, error)

func (RealSystem) UserHomeDir

func (RealSystem) UserHomeDir() (string, error)

func (RealSystem) WriteFile

func (RealSystem) WriteFile(name string, data []byte, perm os.FileMode) error

type System

type System interface {
	Executable() (string, error)
	UserHomeDir() (string, error)
	MkdirAll(path string, perm os.FileMode) error
	WriteFile(name string, data []byte, perm os.FileMode) error
	RemoveFile(name string) error
	RunCommand(name string, args ...string) ([]byte, error)
	Stat(name string) (os.FileInfo, error)
}

System abstracts OS operations for testability.

Jump to

Keyboard shortcuts

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