systemd

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecCode

type ExecCode int
const (
	CodeUndefined ExecCode = iota
	CodeExited
	CodeKilled
	CodeDumped
)

type ExecCommandState

type ExecCommandState struct {
	Path          string    // The binary path to execute
	Arguments     []string  // An array with all arguments to pass to the executed command, starting with argument 0
	Fail          bool      // A boolean whether it should be considered a failure if the process exits uncleanly
	EnterTime     time.Time // CLOCK_REALTIME time when the process began running the last time
	EnterTimeMono int64     // CLOCK_MONOTONIC usec timestamps when the process began running the last time
	ExitTime      time.Time // CLOCK_REALTIME time when the process finished running the last time
	ExitTimeMono  int64     // CLOCK_MONOTONIC usec timestamps when the process finished running the last time
	ExecPID       int       // The PID of the process (or 0 if it has not run yet)
	ExecCode      ExecCode  // The exit code of the last run
	ExecStatus    int       // The exit status
}

func (*ExecCommandState) UnmarshalJSON

func (s *ExecCommandState) UnmarshalJSON(b []byte) error

type Manager

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

func NewManager

func NewManager() (*Manager, error)

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Disable

func (m *Manager) Disable(unitname string) error

func (*Manager) Enable

func (m *Manager) Enable(unitname string) error

func (*Manager) GetAllUnits

func (m *Manager) GetAllUnits(pattern string) ([]*UnitStatus, error)

func (*Manager) GetUnit

func (m *Manager) GetUnit(unitname string) (*UnitStatus, error)

func (*Manager) GetUnitProperties

func (m *Manager) GetUnitProperties(unitname string) (*UnitProperties, error)

func (*Manager) Kill

func (m *Manager) Kill(unitname string, signal syscall.Signal)

func (*Manager) KillBySIGKILL

func (m *Manager) KillBySIGKILL(unitname string)

func (*Manager) KillBySIGTERM

func (m *Manager) KillBySIGTERM(unitname string)

func (*Manager) Restart

func (m *Manager) Restart(unitname string, ch chan<- string) error

func (*Manager) Start

func (m *Manager) Start(unitname string, ch chan<- string) error

func (*Manager) StartAndTest

func (m *Manager) StartAndTest(unitname string, interval time.Duration, ch chan<- string) error

func (*Manager) Stop

func (m *Manager) Stop(unitname string, ch chan<- string) error

func (*Manager) StopAndWait

func (m *Manager) StopAndWait(unitname string, interval time.Duration, ch chan<- string) error

type UnitProperties

type UnitProperties struct {
	Name            string `json:"-"` // The primary unit name as string
	LoadState       string // The load state (i.e. whether the unit file has been loaded successfully)
	ActiveState     string // The active state (i.e. whether the unit is currently started or not)
	SubState        string // The sub state (a more fine-grained version of the active state that is specific to the unit type, which the active state is not)
	ExecMainPID     int    // The main PID is the current main PID of the service and is 0 when the service currently has no main PID
	ActiveEnterTime time.Time
	ActiveExitTime  time.Time
	StateChangeTime time.Time
	ExecStart       []ExecCommandState
	ExecStartPost   []ExecCommandState
	ExecStartPre    []ExecCommandState
	ExecStop        []ExecCommandState
	ExecStopPost    []ExecCommandState
}

type UnitStatus

type UnitStatus struct {
	Name        string // The primary unit name as string
	LoadState   string // The load state (i.e. whether the unit file has been loaded successfully)
	ActiveState string // The active state (i.e. whether the unit is currently started or not)
	SubState    string // The sub state (a more fine-grained version of the active state that is specific to the unit type, which the active state is not)
}

Jump to

Keyboard shortcuts

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