Documentation
¶
Index ¶
- Constants
- func EntertainWatchdog() error
- func EscapeObjectPath(path string) string
- func Notify(msg string) error
- type Connector
- func (c *Connector) AddMatchSignal(options ...dbus.MatchOption) error
- func (c *Connector) CheckUnitState(unitName string, ctx context.Context) (string, error)
- func (c *Connector) Connected() bool
- func (c *Connector) GetRawDbusClient() *dbuscon.Client
- func (c *Connector) GetRawDbusConnection() *dbus.Conn
- func (c *Connector) RemoveMatchSignal(options ...dbus.MatchOption) error
- func (c *Connector) RemoveSignal(ch chan<- *dbus.Signal) error
- func (c *Connector) ReqRestartUnit(unitName string, ctx context.Context, cb chan<- string) error
- func (c *Connector) ReqStartUnit(unitName string, ctx context.Context, cb chan<- string) error
- func (c *Connector) ReqStopUnit(unitName string, ctx context.Context, cb chan<- string) error
- func (c *Connector) RequestReconnect() error
- func (c *Connector) RestartUnit(unitName string, ctx context.Context) (bool, error)
- func (c *Connector) Shutdown() error
- func (c *Connector) Signal(ch chan<- *dbus.Signal) error
- func (c *Connector) StartUnit(unitName string, ctx context.Context) (bool, error)
- func (c *Connector) StopUnit(unitName string, ctx context.Context) (bool, error)
Constants ¶
const ( NotifySocketEnvVar = "NOTIFY_SOCKET" NotifyWatchdog = "WATCHDOG=1" NotifyReloading = "RELOADING=1" NotifyStopping = "STOPPING=1" NotifyReady = "READY=1" ServiceStateActive = "active" JobResultDone = "done" BusObjectPropertyActiveState = "ActiveState" BusObjectSystemdDest = "org.freedesktop.systemd1" BusObjectSystemdDestUnit = BusObjectSystemdDest + ".Unit" BusObjectSystemdPath = "/org/freedesktop/systemd1" BusObjectSystemdUnitTmpl = "/org/freedesktop/systemd1/unit/%s" BusMemberGetProp = "org.freedesktop.DBus.Properties.Get" // Systemd Manager actions BusManagerInterface = BusObjectSystemdDest + ".Manager" BusInterfaceStartUnit = BusManagerInterface + ".StartUnit" BusInterfaceStopUnit = BusManagerInterface + ".StopUnit" BusInterfaceRestartUnit = BusManagerInterface + ".RestartUnit" // Signals BusMemberJobRemoved = "JobRemoved" BusSignalJobRemoved = BusManagerInterface + "." + BusMemberJobRemoved BusMemberJobNew = "JobNew" BusMemberUnitNew = "UnitNew" BusMemberUnitRemoved = "UnitRemoved" BusMemberStartupFinished = "StartupFinished" NetworkManagerUserConfigDirectory = "/etc/NetworkManager/system-connections/" NetworkManagerActivationTimeout = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func EntertainWatchdog ¶
func EntertainWatchdog() error
EntertainWatchdog sends a notification to the systemd watchdog
func EscapeObjectPath ¶
EscapeObjectPath sanitizes a D-Bus ObjectPath string. This function replaces any characters that are not letters or digits with their corresponding hexadecimal encoding, preceded by an underscore character. If the input string is empty, this function returns an underscore character.
Types ¶
type Connector ¶
func (*Connector) AddMatchSignal ¶
func (c *Connector) AddMatchSignal(options ...dbus.MatchOption) error
AddMatchSignal adds a match signal
func (*Connector) CheckUnitState ¶
Retrieves the unit state for a specified unit
func (*Connector) GetRawDbusClient ¶
GetRawDbusClient returns the underlying dbus client of this instance, use wisely!
func (*Connector) GetRawDbusConnection ¶
GetRawDbusConnection returns the currently active dbus connection
func (*Connector) RemoveMatchSignal ¶
func (c *Connector) RemoveMatchSignal(options ...dbus.MatchOption) error
RemoveMatchSignal removes a match signal
func (*Connector) RemoveSignal ¶
RemoveSignal removes a signal channel from the list
func (*Connector) ReqRestartUnit ¶
ReqRestartUnit performs a restart and offers to pass on the data to the callback channel
func (*Connector) ReqStartUnit ¶
ReqStartUnit performs a start and offers to pass on the data to the callback channel
func (*Connector) ReqStopUnit ¶
ReqStopUnit performs a stop and offers to pass on the data to the callback channel
func (*Connector) RequestReconnect ¶
This function requests a reconnect
func (*Connector) RestartUnit ¶
RestartUnit synchronously restarts an unit and returns true if it succeded