Documentation
¶
Index ¶
- Constants
- type DbusConn
- type DbusExecStart
- type DbusObject
- type DbusProperty
- type DbusPropertySet
- type ExecConfig
- type OsPts
- type Pts
- type SystemdConnection
- type SystemdOsConnection
- func (sc *SystemdOsConnection) Close() error
- func (sc *SystemdOsConnection) ListUnits(ctx context.Context) ([]*Unit, error)
- func (sc *SystemdOsConnection) Signal(ch chan<- *dbus.Signal)
- func (sc *SystemdOsConnection) StartTransientUnit(ctx context.Context, name string, mode string, props []DbusProperty) (dbus.ObjectPath, error)
- func (sc *SystemdOsConnection) StopUnit(ctx context.Context, unitName string) error
- type SystemdSupervisor
- func (s *SystemdSupervisor) AddServiceWatcher(serviceName string, ch chan<- *UnitProperties)
- func (s *SystemdSupervisor) RemoveServiceWatcher(serviceName string, ch chan<- *UnitProperties)
- func (sd *SystemdSupervisor) RunOneshot(ctx context.Context, config *ExecConfig) (string, error)
- func (s *SystemdSupervisor) Start()
- func (sd *SystemdSupervisor) StartService(ctx context.Context, config *ExecConfig) (string, error)
- func (s *SystemdSupervisor) Stop() error
- type Unit
- type UnitProperties
Constants ¶
View Source
const ( PtmxPathEnv = "PTMX_PATH" DefaultPtmxPath = "/dev/ptmx" )
View Source
const ( UnitNewMethod = "org.freedesktop.systemd1.Manager.UnitNew" UnitRemovedMethod = "org.freedesktop.systemd1.Manager.UnitRemoved" PropertiesChangedMethod = "org.freedesktop.DBus.Properties.PropertiesChanged" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbusConn ¶
type DbusConn interface { Object(dest string, path dbus.ObjectPath) dbus.BusObject Signal(ch chan<- *dbus.Signal) Close() error }
DbusConn is a wrapper for the dbus.Conn external type
type DbusExecStart ¶
DbusExecStart property for systemd services
type DbusObject ¶
type DbusObject interface {
Go(method string, flags dbus.Flags, ch chan *dbus.Call, args ...any) *dbus.Call
}
DbusObject is a wrapper for dbus.BusObject external type
type DbusProperty ¶
DbusProperty is used for dbus arguments that are arrays of key value pairs
type DbusPropertySet ¶
type DbusPropertySet struct { Name string Value []DbusProperty }
type ExecConfig ¶
type ExecConfig struct { Name string Description string ExecPath string Args []string Env []string }
func (*ExecConfig) ToDbus ¶
func (ec *ExecConfig) ToDbus(ptsN int, serviceType string) []DbusProperty
type Pts ¶
type Pts interface {
NewPts() (io.ReadCloser, int, error)
}
Interface for creating new private terminal session. See man pts(4)
type SystemdConnection ¶
type SystemdOsConnection ¶
type SystemdOsConnection struct { Conn DbusConn Object DbusObject }
SystemdOsConnection is a low level api thinly wrapping the systemd dbus calls See https://www.freedesktop.org/wiki/Software/systemd/dbus/ for the DBus API
func NewSystemdOsConnection ¶
func NewSystemdOsConnection() (*SystemdOsConnection, error)
Connect to the systemd dbus socket and return a SystemdOsConnection
func (*SystemdOsConnection) Close ¶
func (sc *SystemdOsConnection) Close() error
func (*SystemdOsConnection) ListUnits ¶
func (sc *SystemdOsConnection) ListUnits(ctx context.Context) ([]*Unit, error)
func (*SystemdOsConnection) Signal ¶
func (sc *SystemdOsConnection) Signal(ch chan<- *dbus.Signal)
func (*SystemdOsConnection) StartTransientUnit ¶
func (sc *SystemdOsConnection) StartTransientUnit(ctx context.Context, name string, mode string, props []DbusProperty) (dbus.ObjectPath, error)
type SystemdSupervisor ¶
type SystemdSupervisor struct {
// contains filtered or unexported fields
}
func NewSystemdSupervisor ¶
func NewSystemdSupervisor(conn SystemdConnection, pts Pts) *SystemdSupervisor
func StartOsSystemdSupervisor ¶
func StartOsSystemdSupervisor() (*SystemdSupervisor, error)
func (*SystemdSupervisor) AddServiceWatcher ¶
func (s *SystemdSupervisor) AddServiceWatcher(serviceName string, ch chan<- *UnitProperties)
func (*SystemdSupervisor) RemoveServiceWatcher ¶
func (s *SystemdSupervisor) RemoveServiceWatcher(serviceName string, ch chan<- *UnitProperties)
func (*SystemdSupervisor) RunOneshot ¶
func (sd *SystemdSupervisor) RunOneshot(ctx context.Context, config *ExecConfig) (string, error)
func (*SystemdSupervisor) Start ¶
func (s *SystemdSupervisor) Start()
func (*SystemdSupervisor) StartService ¶
func (sd *SystemdSupervisor) StartService(ctx context.Context, config *ExecConfig) (string, error)
func (*SystemdSupervisor) Stop ¶
func (s *SystemdSupervisor) Stop() error
type UnitProperties ¶
Click to show internal directories.
Click to hide internal directories.