barista.run: barista.run/modules/systemd Index | Files

package systemd

import "barista.run/modules/systemd"

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

Index

Package Files

systemd.go

Constants

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")
)

type ServiceInfo Uses

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

ServiceInfo represents the state of a systemd service.

type ServiceModule Uses

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

ServiceModule watches a systemd service and updates on status change

func Service Uses

func Service(name string) *ServiceModule

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

func (*ServiceModule) Output Uses

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 Uses

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

Stream starts the module.

type State Uses

type State string

State represents possible states of a systemd unit.

type TimerInfo Uses

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

TimerInfo represents the state of a systemd timer.

type TimerModule Uses

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

TimerModule watches a systemd timer and updates on status change

func Timer Uses

func Timer(name string) *TimerModule

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

func (*TimerModule) Output Uses

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 Uses

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

Stream starts the module.

type UnitInfo Uses

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 Uses

func (u UnitInfo) Reload()

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

func (UnitInfo) Restart Uses

func (u UnitInfo) Restart()

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

func (UnitInfo) Start Uses

func (u UnitInfo) Start()

Start enqeues a start job, and possibly depending jobs.

func (UnitInfo) Stop Uses

func (u UnitInfo) Stop()

Stop stops the specified unit rather than starting it.

Package systemd imports 9 packages (graph). Updated 2019-11-14. Refresh now. Tools for package owners.