Documentation
¶
Overview ¶
Package systemd provides modules for watching the status of a systemd unit.
Index ¶
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") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceInfo ¶
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 TimerInfo ¶
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.
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.