systemd

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceFile added in v0.9.0

func GetServiceFile(profileName, commandName string) string

GetServiceFile returns the service file name for the profile

func GetServiceFileDropInDir added in v0.25.0

func GetServiceFileDropInDir(profileName, commandName string) string

GetServiceFileDropInDir returns the service file drop-in dir name for the profile

func GetSystemDir added in v0.9.0

func GetSystemDir() string

GetSystemDir returns the path where the local systemd units are stored

func GetTimerFile added in v0.9.0

func GetTimerFile(profileName, commandName string) string

GetTimerFile returns the timer file name for the profile

func GetTimerFileDropInDir added in v0.27.0

func GetTimerFileDropInDir(profileName, commandName string) string

GetTimerFileDropInDir returns the timer file drop-in dir name for the profile

Types

type Config added in v0.16.0

type Config struct {
	CommandLine          string
	Environment          []string
	WorkingDirectory     string
	Title                string
	SubTitle             string
	JobDescription       string
	TimerDescription     string
	Schedules            []string
	UnitType             UnitType
	Priority             string // standard or background
	UnitFile             string
	TimerFile            string
	DropInFiles          []string
	AfterNetworkOnline   bool
	Nice                 int
	CPUSchedulingPolicy  string
	IOSchedulingClass    int
	IOSchedulingPriority int
	User                 string
}

Config for generating systemd unit and timer files

type Unit added in v0.30.0

type Unit struct {
	// contains filtered or unexported fields
}

func NewUnit added in v0.30.0

func NewUnit(user user.User) Unit

func (Unit) DropInFileExists added in v0.31.0

func (u Unit) DropInFileExists(file string) bool

func (Unit) Generate added in v0.30.0

func (u Unit) Generate(config Config) error

Generate systemd unit

func (Unit) GetUserDir added in v0.30.0

func (u Unit) GetUserDir() (string, error)

GetUserDir returns the default directory where systemd stores user units

func (Unit) IsTimerDropIn added in v0.30.0

func (u Unit) IsTimerDropIn(file string) bool

func (Unit) Read added in v0.30.0

func (u Unit) Read(unit string, unitType UnitType) (*Config, error)

Read parses systemd service and timer unit files and returns their configuration. The unit parameter should be in the format "resticprofile-backup@profile-name.service". The unitType parameter determines whether to read from system or user unit directories.

type UnitType added in v0.9.0

type UnitType int

UnitType is either user or system

const (
	UserUnit UnitType = iota
	SystemUnit
)

Type of systemd unit

Jump to

Keyboard shortcuts

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