systemd

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package systemd provides modules for watching the status of a systemd unit.

Index

Constants

View Source
const (
	// StateUnknown indicates an unknown unit state.
	StateUnknown = State("")
	// StateActive indicates that unit is active.
	StateActive = State("active")
	// StateReloading indicates that the unit is active and currently reloading
	// its configuration.
	StateReloading = State("reloading")
	// StateInactive indicates that it is inactive and the previous run was
	// successful or no previous run has taken place yet.
	StateInactive = State("inactive")
	// StateFailed indicates that it is inactive and the previous run was not
	// successful.
	StateFailed = State("failed")
	// StateActivating indicates that the unit has previously been inactive but
	// is currently in the process of entering an active state.
	StateActivating = State("activating")
	// StateDeactivating indicates that the unit is currently in the process of
	// deactivation.
	StateDeactivating = State("deactivating")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceInfo

type ServiceInfo struct {
	UnitInfo
	Type    string
	ExecPID uint32
	MainPID uint32
}

ServiceInfo represents the state of a systemd service.

type ServiceModule

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

ServiceModule watches a systemd service and updates on status change

func Service

func Service(name string) *ServiceModule

Service creates a module that watches the status of a systemd service.

func UserService

func UserService(name string) *ServiceModule

UserService create a module that watches the status of a systemd user service.

func (*ServiceModule) Output

func (s *ServiceModule) Output(outputFunc func(ServiceInfo) bar.Output) *ServiceModule

Output configures a module to display the output of a user-defined function.

func (*ServiceModule) Stream

func (s *ServiceModule) Stream(sink bar.Sink)

Stream starts the module.

type State

type State string

State represents possible states of a systemd unit.

type TimerInfo

type TimerInfo struct {
	UnitInfo
	Unit        string
	LastTrigger time.Time
	NextTrigger time.Time
}

TimerInfo represents the state of a systemd timer.

type TimerModule

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

TimerModule watches a systemd timer and updates on status change

func Timer

func Timer(name string) *TimerModule

Timer creates a module that watches the status of a systemd timer.

func UserTimer

func UserTimer(name string) *TimerModule

UserTimer creates a module that watches the status of a systemd user timer.

func (*TimerModule) Output

func (t *TimerModule) Output(outputFunc func(TimerInfo) bar.Output) *TimerModule

Output configures a module to display the output of a user-defined function.

func (*TimerModule) Stream

func (t *TimerModule) Stream(sink bar.Sink)

Stream starts the module.

type UnitInfo

type UnitInfo struct {
	ID          string
	Description string
	State       State
	SubState    string
	Since       time.Time
	// contains filtered or unexported fields
}

UnitInfo includes common information present in both services and timers.

func (UnitInfo) Reload

func (u UnitInfo) Reload()

Reload reloads a unit. Reloading is done only if the unit is already running and fails otherwise.

func (UnitInfo) Restart

func (u UnitInfo) Restart()

Restart restarts a unit. If a service is restarted that isn't running it will be started.

func (UnitInfo) Start

func (u UnitInfo) Start()

Start enqueues a start job, and possibly dependant jobs.

func (UnitInfo) Stop

func (u UnitInfo) Stop()

Stop stops the specified unit rather than starting it.

Jump to

Keyboard shortcuts

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