unit

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSignalName is returned when the signal name used is invalid
	ErrInvalidSignalName = errors.New("Invalid signal name")

	// ErrInvalidSignalNumber is returned when the signal number used is invalid
	ErrInvalidSignalNumber = errors.New("Invalid signal number")
)

Functions

func PPUnit

func PPUnit(u *Unit) string

PPUnit pretty-prints a unit

func PPtUnitStatus

func PPtUnitStatus(u *dbus.UnitStatus) string

PPtUnitStatus pretty-prints a UnitStatus

Types

type AutomountTypeProperties

type AutomountTypeProperties struct {
	DirectoryMode   uint32 `export:"DirectoryMode"`
	Result          string `export:"Result"`
	TimeoutIdleUSec uint64 `export:"TimeoutIdleUSec"`
	Where           string `export:"Where"`
}

AutomountTypeProperties wraps the dbus api for system with properties from this unit type

type DeviceTypeProperties

type DeviceTypeProperties struct {
	SysFSPath string `export:"SysFSPath"`
}

DeviceTypeProperties wraps the dbus api for system with properties from this unit type

type LinuxExecutor

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

LinuxExecutor provides a command executor for interacting with systemd on Linux

func (LinuxExecutor) Close

func (l LinuxExecutor) Close()

Close will close a connection

func (LinuxExecutor) ListUnits

func (l LinuxExecutor) ListUnits() ([]*Unit, error)

ListUnits will use dbus to get a list of all units

func (LinuxExecutor) QueryUnit

func (l LinuxExecutor) QueryUnit(unitName string, verify bool) (*Unit, error)

QueryUnit will use dbus to get the unit status by name

func (LinuxExecutor) ReloadUnit

func (l LinuxExecutor) ReloadUnit(u *Unit) error

ReloadUnit will use dbus to reload a unit

func (LinuxExecutor) RestartUnit

func (l LinuxExecutor) RestartUnit(u *Unit) error

RestartUnit will restart a unit

func (LinuxExecutor) SendSignal

func (l LinuxExecutor) SendSignal(u *Unit, signal Signal)

SendSignal will send a signal

func (LinuxExecutor) StartUnit

func (l LinuxExecutor) StartUnit(u *Unit) error

StartUnit will use dbus to start a unit

func (LinuxExecutor) StopUnit

func (l LinuxExecutor) StopUnit(u *Unit) error

StopUnit will use dbus to stop a unit

type MountTypeProperties

type MountTypeProperties struct {
	AmbientCapabilities      uint64          `export:"AmbientCapabilities"`
	AppArmorProfile          []interface{}   `export:"AppArmorProfile"`
	BlockIOAccounting        bool            `export:"BlockIOAccounting"`
	BlockIODeviceWeight      [][]interface{} `export:"BlockIODeviceWeight"`
	BlockIOReadBandwidth     [][]interface{} `export:"BlockIOReadBandwidth"`
	BlockIOWeight            uint64          `export:"BlockIOWeight"`
	BlockIOWriteBandwidth    [][]interface{} `export:"BlockIOWriteBandwidth"`
	CPUAccounting            bool            `export:"CPUAccounting"`
	CPUAffinity              []uint8         `export:"CPUAffinity"`
	CPUQuotaPerSecUSec       uint64          `export:"CPUQuotaPerSecUSec"`
	CPUSchedulingPolicy      int32           `export:"CPUSchedulingPolicy"`
	CPUSchedulingPriority    int32           `export:"CPUSchedulingPriority"`
	CPUSchedulingResetOnFork bool            `export:"CPUSchedulingResetOnFork"`
	CPUShares                uint64          `export:"CPUShares"`
	CPUUsageNSec             uint64          `export:"CPUUsageNSec"`
	Capabilities             string          `export:"Capabilities"`
	CapabilityBoundingSet    uint64          `export:"CapabilityBoundingSet"`
	ControlGroup             string          `export:"ControlGroup"`
	ControlPID               uint32          `export:"ControlPID"`
	Delegate                 bool            `export:"Delegate"`
	DeviceAllow              [][]interface{} `export:"DeviceAllow"`
	DevicePolicy             string          `export:"DevicePolicy"`
	DirectoryMode            uint32          `export:"DirectoryMode"`
	Environment              []string        `export:"Environment"`
	EnvironmentFiles         [][]interface{} `export:"EnvironmentFiles"`
	ExecMount                [][]interface{} `export:"ExecMount"`
	ExecRemount              [][]interface{} `export:"ExecRemount"`
	ExecUnmount              [][]interface{} `export:"ExecUnmount"`
	Group                    string          `export:"Group"`
	IOScheduling             int32           `export:"IOScheduling"`
	IgnoreSIGPIPE            bool            `export:"IgnoreSIGPIPE"`
	InaccessibleDirectories  []string        `export:"InaccessibleDirectories"`
	KillMode                 string          `export:"KillMode"`
	KillSignal               int32           `export:"KillSignal"`
	LimitAS                  uint64          `export:"LimitAS"`
	LimitASSoft              uint64          `export:"LimitASSoft"`
	LimitCORE                uint64          `export:"LimitCORE"`
	LimitCORESoft            uint64          `export:"LimitCORESoft"`
	LimitCPU                 uint64          `export:"LimitCPU"`
	LimitCPUSoft             uint64          `export:"LimitCPUSoft"`
	LimitDATA                uint64          `export:"LimitDATA"`
	LimitDATASoft            uint64          `export:"LimitDATASoft"`
	LimitFSIZE               uint64          `export:"LimitFSIZE"`
	LimitFSIZESoft           uint64          `export:"LimitFSIZESoft"`
	LimitLOCKS               uint64          `export:"LimitLOCKS"`
	LimitLOCKSSoft           uint64          `export:"LimitLOCKSSoft"`
	LimitMEMLOCK             uint64          `export:"LimitMEMLOCK"`
	LimitMEMLOCKSoft         uint64          `export:"LimitMEMLOCKSoft"`
	LimitMSGQUEUE            uint64          `export:"LimitMSGQUEUE"`
	LimitMSGQUEUESoft        uint64          `export:"LimitMSGQUEUESoft"`
	LimitNICE                uint64          `export:"LimitNICE"`
	LimitNICESoft            uint64          `export:"LimitNICESoft"`
	LimitNOFILE              uint64          `export:"LimitNOFILE"`
	LimitNOFILESoft          uint64          `export:"LimitNOFILESoft"`
	LimitNPROC               uint64          `export:"LimitNPROC"`
	LimitNPROCSoft           uint64          `export:"LimitNPROCSoft"`
	LimitRSS                 uint64          `export:"LimitRSS"`
	LimitRSSSoft             uint64          `export:"LimitRSSSoft"`
	LimitRTPRIO              uint64          `export:"LimitRTPRIO"`
	LimitRTPRIOSoft          uint64          `export:"LimitRTPRIOSoft"`
	LimitRTTIME              uint64          `export:"LimitRTTIME"`
	LimitRTTIMESoft          uint64          `export:"LimitRTTIMESoft"`
	LimitSIGPENDING          uint64          `export:"LimitSIGPENDING"`
	LimitSIGPENDINGSoft      uint64          `export:"LimitSIGPENDINGSoft"`
	LimitSTACK               uint64          `export:"LimitSTACK"`
	LimitSTACKSoft           uint64          `export:"LimitSTACKSoft"`
	MemoryAccounting         bool            `export:"MemoryAccounting"`
	MemoryCurrent            uint64          `export:"MemoryCurrent"`
	MemoryLimit              uint64          `export:"MemoryLimit"`
	MountFlags               uint64          `export:"MountFlags"`
	Nice                     int32           `export:"Nice"`
	NoNewPrivileges          bool            `export:"NoNewPrivileges"`
	NonBlocking              bool            `export:"NonBlocking"`
	OOMScoreAdjust           int32           `export:"OOMScoreAdjust"`
	Options                  string          `export:"Options"`
	PAMName                  string          `export:"PAMName"`
	PassEnvironment          []string        `export:"PassEnvironment"`
	Personality              string          `export:"Personality"`
	PrivateDevices           bool            `export:"PrivateDevices"`
	PrivateNetwork           bool            `export:"PrivateNetwork"`
	PrivateTmp               bool            `export:"PrivateTmp"`
	ProtectHome              string          `export:"ProtectHome"`
	ProtectSystem            string          `export:"ProtectSystem"`
	ReadOnlyDirectories      []string        `export:"ReadOnlyDirectories"`
	ReadWriteDirectories     []string        `export:"ReadWriteDirectories"`
	RestrictAddressFamilies  []interface{}   `export:"RestrictAddressFamilies"`
	Result                   string          `export:"Result"`
	RootDirectory            string          `export:"RootDirectory"`
	RuntimeDirectory         []string        `export:"RuntimeDirectory"`
	RuntimeDirectoryMode     uint32          `export:"RuntimeDirectoryMode"`
	SELinuxContext           []interface{}   `export:"SELinuxContext"`
	SameProcessGroup         bool            `export:"SameProcessGroup"`
	SecureBits               int32           `export:"SecureBits"`
	SendSIGHUP               bool            `export:"SendSIGHUP"`
	SendSIGKILL              bool            `export:"SendSIGKILL"`
	Slice                    string          `export:"Slice"`
	SloppyOptions            bool            `export:"SloppyOptions"`
	SmackProcessLabel        []interface{}   `export:"SmackProcessLabel"`
	StandardError            string          `export:"StandardError"`
	StandardInput            string          `export:"StandardInput"`
	StandardOutput           string          `export:"StandardOutput"`
	StartupBlockIOWeight     uint64          `export:"StartupBlockIOWeight"`
	StartupCPUShares         uint64          `export:"StartupCPUShares"`
	SupplementaryGroups      []string        `export:"SupplementaryGroups"`
	SyslogFacility           int32           `export:"SyslogFacility"`
	SyslogIdentifier         string          `export:"SyslogIdentifier"`
	SyslogLevel              int32           `export:"SyslogLevel"`
	SyslogLevelPrefix        bool            `export:"SyslogLevelPrefix"`
	SyslogPriority           int32           `export:"SyslogPriority"`
	SystemCallArchitectures  []string        `export:"SystemCallArchitectures"`
	SystemCallErrorNumber    int32           `export:"SystemCallErrorNumber"`
	SystemCallFilter         []interface{}   `export:"SystemCallFilter"`
	TTYPath                  string          `export:"TTYPath"`
	TTYReset                 bool            `export:"TTYReset"`
	TTYVHangup               bool            `export:"TTYVHangup"`
	TTYVTDisallocate         bool            `export:"TTYVTDisallocate"`
	TasksAccounting          bool            `export:"TasksAccounting"`
	TasksCurrent             uint64          `export:"TasksCurrent"`
	TasksMax                 uint64          `export:"TasksMax"`
	TimeoutUSec              uint64          `export:"TimeoutUSec"`
	TimerSlackNSec           uint64          `export:"TimerSlackNSec"`
	Type                     string          `export:"Type"`
	UMask                    uint32          `export:"UMask"`
	User                     string          `export:"User"`
	UtmpIdentifier           string          `export:"UtmpIdentifier"`
	UtmpMode                 string          `export:"UtmpMode"`
	What                     string          `export:"What"`
	Where                    string          `export:"Where"`
	WorkingDirectory         string          `export:"WorkingDirectory"`
}

MountTypeProperties wraps the dbus api for system with properties from this unit type

type PathTypeProperties

type PathTypeProperties struct {
	DirectoryMode uint32          `export:"DirectoryMode"`
	MakeDirectory bool            `export:"MakeDirectory"`
	Paths         [][]interface{} `export:"Paths"`
	Result        string          `export:"Result"`
	Unit          string          `export:"Unit"`
}

PathTypeProperties wraps the dbus api for system with properties from this unit type

type Preparer

type Preparer struct {
	// The name of the unit.  This may optionally include the unit type,
	// e.g. "foo.service" and "foo" are both valid.
	Name string `hcl:"unit" required:"true"`

	// The desired state of the unit.  This will affect the current unit job.  Use
	// `systemd.unit.file` to enable and disable jobs, or `systemd.unit.config` to
	// set options.
	State string `hcl:"state" valid_values:"running,stopped,restarted"`

	// If reload is true then the service will be instructed to reload it's
	// configuration as if the user had run `systemctl reload`.  This will reload
	// the actual confguration file for the service, not the systemd unit file
	// configuration. See `systemctl(1)` for more information.
	Reload bool `hcl:"reload"`

	// Sends a signal to the process, using it's name.  The signal may be in upper
	// or lower case (the `SIG` prefix) is optional.  For example, to send user
	// defined signal 1 to the process you may write any of: usr1, USR1, SIGUSR1,
	// or sigusr1
	//
	// see `signal(3)` on BSD/Darwin, or `signal(7)` on GNU Linux systems for more
	// information on signals
	SignalName string `hcl:"signal_name" mutually_exclusive:"signal_name,signal_num"`

	// Sends a signal to the process, using it's signal number.  The value must be
	// an unsigned integer value between 1 and 31 inclusive.
	SignalNumber uint `hcl:"signal_number" mutually_exclusive:"signal_name,signal_num"`
	// contains filtered or unexported fields
}

Preparer for UnitState

UnitState configures loaded systemd units, allowing you to start, stop, or restart them, reload configuration files, and send unix signals.

func (*Preparer) Prepare

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare a new task

type Properties

type Properties struct {
	ActiveEnterTimestamp            uint64          `export:"ActiveEnterTimestamp"`
	ActiveEnterTimestampMonotonic   uint64          `export:"ActiveEnterTimestampMonotonic"`
	ActiveExitTimestamp             uint64          `export:"ActiveExitTimestamp"`
	ActiveExitTimestampMonotonic    uint64          `export:"ActiveExitTimestampMonotonic"`
	ActiveState                     string          `export:"ActiveState"`
	After                           []string        `export:"After"`
	AllowIsolate                    bool            `export:"AllowIsolate"`
	AssertResult                    bool            `export:"AssertResult"`
	AssertTimestamp                 uint64          `export:"AssertTimestamp"`
	AssertTimestampMonotonic        uint64          `export:"AssertTimestampMonotonic"`
	Asserts                         [][]interface{} `export:"Asserts"`
	Before                          []string        `export:"Before"`
	BindsTo                         []string        `export:"BindsTo"`
	BoundBy                         []string        `export:"BoundBy"`
	CanIsolate                      bool            `export:"CanIsolate"`
	CanReload                       bool            `export:"CanReload"`
	CanStart                        bool            `export:"CanStart"`
	CanStop                         bool            `export:"CanStop"`
	ConditionResult                 bool            `export:"ConditionResult"`
	ConditionTimestamp              uint64          `export:"ConditionTimestamp"`
	ConditionTimestampMonotonic     uint64          `export:"ConditionTimestampMonotonic"`
	Conditions                      [][]interface{} `export:"Conditions"`
	ConflictedBy                    []string        `export:"ConflictedBy"`
	Conflicts                       []string        `export:"Conflicts"`
	ConsistsOf                      []string        `export:"ConsistsOf"`
	DefaultDependencies             bool            `export:"DefaultDependencies"`
	Description                     string          `export:"Description"`
	Documentation                   []string        `export:"Documentation"`
	DropInPaths                     []string        `export:"DropInPaths"`
	Following                       string          `export:"Following"`
	FragmentPath                    string          `export:"FragmentPath"`
	Id                              string          `export:"Id"`
	IgnoreOnIsolate                 bool            `export:"IgnoreOnIsolate"`
	InactiveEnterTimestamp          uint64          `export:"InactiveEnterTimestamp"`
	InactiveEnterTimestampMonotonic uint64          `export:"InactiveEnterTimestampMonotonic"`
	InactiveExitTimestamp           uint64          `export:"InactiveExitTimestamp"`
	InactiveExitTimestampMonotonic  uint64          `export:"InactiveExitTimestampMonotonic"`
	Job                             []interface{}   `export:"Job"`
	JobTimeoutAction                string          `export:"JobTimeoutAction"`
	JobTimeoutRebootArgument        string          `export:"JobTimeoutRebootArgument"`
	JobTimeoutUSec                  uint64          `export:"JobTimeoutUSec"`
	JoinsNamespaceOf                []string        `export:"JoinsNamespaceOf"`
	LoadError                       []interface{}   `export:"LoadError"`
	LoadState                       string          `export:"LoadState"`
	Names                           []string        `export:"Names"`
	NeedDaemonReload                bool            `export:"NeedDaemonReload"`
	OnFailure                       []string        `export:"OnFailure"`
	OnFailureJobMode                string          `export:"OnFailureJobMode"`
	PartOf                          []string        `export:"PartOf"`
	PropagatesReloadTo              []string        `export:"PropagatesReloadTo"`
	RebootArgument                  string          `export:"RebootArgument"`
	RefuseManualStart               bool            `export:"RefuseManualStart"`
	RefuseManualStop                bool            `export:"RefuseManualStop"`
	ReloadPropagatedFrom            []string        `export:"ReloadPropagatedFrom"`
	RequiredBy                      []string        `export:"RequiredBy"`
	Requires                        []string        `export:"Requires"`
	RequiresMountsFor               []string        `export:"RequiresMountsFor"`
	Requisite                       []string        `export:"Requisite"`
	RequisiteOf                     []string        `export:"RequisiteOf"`
	SourcePath                      string          `export:"SourcePath"`
	StartLimitAction                string          `export:"StartLimitAction"`
	StartLimitBurst                 uint32          `export:"StartLimitBurst"`
	StartLimitInterval              uint64          `export:"StartLimitInterval"`
	StateChangeTimestamp            uint64          `export:"StateChangeTimestamp"`
	StateChangeTimestampMonotonic   uint64          `export:"StateChangeTimestampMonotonic"`
	StopWhenUnneeded                bool            `export:"StopWhenUnneeded"`
	SubState                        string          `export:"SubState"`
	Transient                       bool            `export:"Transient"`
	TriggeredBy                     []string        `export:"TriggeredBy"`
	Triggers                        []string        `export:"Triggers"`
	UnitFilePreset                  string          `export:"UnitFilePreset"`
	UnitFileState                   string          `export:"UnitFileState"`
	WantedBy                        []string        `export:"WantedBy"`
	Wants                           []string        `export:"Wants"`
}

Properties wraps the dbus api for system with properties from this unit type

type Resource

type Resource struct {
	// The name of the unit, including the unit type.
	Name string `export:"unit"`

	// The desired state of the unit as configured by the user. It will be one of
	// `running`, `stopped`, or `restarted` if it was configured by the user, and
	// an empty string otherwise.
	State string `export:"state"`

	// This field is set to true if the reload flag was configured by the user.
	Reload bool `export:"reload"`

	// The human-readable name of a unix signal that will be sent to the process.
	// If this is set the name will match the field set in SignalNumber.  See the
	// man pages for `signal(3)` on BSD/Darwin or `signal(7)` on GNU Linux for a
	// full explanation of these signals.
	SignalName string `export:"signal_name"`

	// The numeric identifier of a unix signal that will be sent to the process.
	// If this is set it will match the field set in SignalName.  See the man
	// pages for `signal(3)` on BSD/Darwin or `signal(7)` on GNU Linux for a full
	// explanation of these signals.
	SignalNumber uint `export:"signal_number"`

	// The full path to the unit file on disk. This field will be empty if the
	// unit was not started from a systemd unit file on disk.
	Path string `export:"path"`

	// Description of the services. This field will be empty unless a description
	// has been provided in the systemd unit file.
	Description string `export:"description"`

	// The active state of the unit. It will always be one of: `active`,
	// `reloading`, `inactive`, `failed`, `activating`, `deactivating`.
	ActiveState string `export:"activestate"`

	// The load state of the unit.
	LoadState string `export:"loadstate"`

	// The type of the unit as an enumerated value.  See TypeStr for a human
	// readable type.
	Type UnitType `export:"type"`

	// The type of the unit as a human readable string.  See the man page for
	// `systemd(1)` for a full description of the types and their meaning.
	TypeStr string `export:"typestr"`

	// The status represents the current status of the process.  It will be
	// initialized during planning and updated after apply to reflect any changes.
	Status string `export:"status"`

	// Properties are the global systemd unit properties and will be set for all
	// unit types. See the [systemd_Properties]({{< ref "properties.md" >}}) docs
	// for more information.
	Properties Properties `re-export-as:"global_properties"`

	// ServiceProperties contain properties specific to Service unit types. This
	// field is only exported when the unit type is `service`. See the
	// [systemd_ServiceTypeProperties]({{< ref "service_properties.md" >}}) docs
	// for more information.
	ServiceProperties *ServiceTypeProperties `re-export-as:"service_properties"`

	// SocketProperties contain properties specific to Socket unit types. This
	// field is only exported when the unit type is `socket`. See the
	// [systemd_SocketTypeProperties]({{< ref "socket_properties.md" >}}) docs for
	// more information.
	SocketProperties *SocketTypeProperties `re-export-as:"socket_properties"`

	// DeviceProperties contain properties specific to Device unit types. This
	// field is only exported when the unit type is `device`. See the
	// [systemd_DeviceTypeProperties]({{< ref "device_properties.md" >}}) docs for
	// more information.
	DeviceProperties *DeviceTypeProperties `re-export-as:"device_properties"`

	// MountProperties contain properties specific to Mount unit types. This field
	// is only exported when the unit type is `mount`. See the
	// [systemd_MountTypeProperties]({{< ref "mount_properties.md" >}}) docs for
	// more information.
	MountProperties *MountTypeProperties `re-export-as:"mount_properties"`

	// AutomountProperties contain properties specific to Autoumount unit types.
	// This field is only exported when the unit type is`automount`. See the
	// [systemd_AutomountTypeProperties]({{< ref "automount_properties.md" >}})
	// docs for more information.
	AutomountProperties *AutomountTypeProperties `re-export-as:"automount_properties"`

	// SwapProperties contain properties specific to Swap unit types. This field
	// is only exported when the unit type is `swap`. See the
	// [systemd_SwapTypeProperties]({{< ref "swap_properties.md" >}}) docs for
	// more information.
	SwapProperties *SwapTypeProperties `re-export-as:"swap_properties"`

	// PathProperties contain properties specific to Path unit types. This field
	// is only exported when the unit type is `path`. See the
	// [systemd_PathTypeProperties]({{< ref "path_properties.md" >}}) docs for
	// more information.
	PathProperties *PathTypeProperties `re-export-as:"path_properties"`

	// TimerProperties contain properties specific to Timer unit types. This field
	// is only exported when the unit type is `timer`. See the
	// [systemd_TimerTypeProperties]({{< ref "timer_properties.md" >}}) docs for
	// more information.
	TimerProperties *TimerTypeProperties `re-export-as:"timer_properties"`

	// SliceProperties contain properties specific to Slice unit types. This field
	// is only exported when the unit type is `slice`. See the
	// [systemd_SliceTypeProperties]({{< ref "slice_properties.md" >}}) docs for
	// more information.
	SliceProperties *SliceTypeProperties `re-export-as:"slice_properties"`

	// ScopeProperties contain properties specific to Scope unit types. This field
	// is only exported when the unit type is `scope`. See the
	// [systemd_ScopeTypeProperties]({{< ref "scope_properties.md" >}}) docs for
	// more information.
	ScopeProperties *ScopeTypeProperties `re-export-as:"scope_properties"`
	// contains filtered or unexported fields
}

Resource is the resource struct for systemd.unit.

Many of the exported fields are derived from the systemd dbus api; see https://www.freedesktop.org/wiki/Software/systemd/dbus/ for a full description of the potential values for this fields and their meanings.

func (*Resource) Apply

func (r *Resource) Apply(ctx context.Context) (resource.TaskStatus, error)

Apply implemnts resource.Task

func (*Resource) Check

Check implements resource.Task

type ScopeTypeProperties

type ScopeTypeProperties struct {
	BlockIOAccounting     bool            `export:"BlockIOAccounting"`
	BlockIODeviceWeight   [][]interface{} `export:"BlockIODeviceWeight"`
	BlockIOReadBandwidth  [][]interface{} `export:"BlockIOReadBandwidth"`
	BlockIOWeight         uint64          `export:"BlockIOWeight"`
	BlockIOWriteBandwidth [][]interface{} `export:"BlockIOWriteBandwidth"`
	CPUAccounting         bool            `export:"CPUAccounting"`
	CPUQuotaPerSecUSec    uint64          `export:"CPUQuotaPerSecUSec"`
	CPUShares             uint64          `export:"CPUShares"`
	CPUUsageNSec          uint64          `export:"CPUUsageNSec"`
	ControlGroup          string          `export:"ControlGroup"`
	Controller            string          `export:"Controller"`
	Delegate              bool            `export:"Delegate"`
	DeviceAllow           [][]interface{} `export:"DeviceAllow"`
	DevicePolicy          string          `export:"DevicePolicy"`
	KillMode              string          `export:"KillMode"`
	KillSignal            int32           `export:"KillSignal"`
	MemoryAccounting      bool            `export:"MemoryAccounting"`
	MemoryCurrent         uint64          `export:"MemoryCurrent"`
	MemoryLimit           uint64          `export:"MemoryLimit"`
	Result                string          `export:"Result"`
	SendSIGHUP            bool            `export:"SendSIGHUP"`
	SendSIGKILL           bool            `export:"SendSIGKILL"`
	Slice                 string          `export:"Slice"`
	StartupBlockIOWeight  uint64          `export:"StartupBlockIOWeight"`
	StartupCPUShares      uint64          `export:"StartupCPUShares"`
	TasksAccounting       bool            `export:"TasksAccounting"`
	TasksCurrent          uint64          `export:"TasksCurrent"`
	TasksMax              uint64          `export:"TasksMax"`
	TimeoutStopUSec       uint64          `export:"TimeoutStopUSec"`
}

ScopeTypeProperties wraps the dbus api for system with properties from this unit type

type ServiceTypeProperties

type ServiceTypeProperties struct {
	AmbientCapabilities             uint64          `export:"AmbientCapabilities"`
	AppArmorProfile                 []interface{}   `export:"AppArmorProfile"`
	BlockIOAccounting               bool            `export:"BlockIOAccounting"`
	BlockIODeviceWeight             [][]interface{} `export:"BlockIODeviceWeight"`
	BlockIOReadBandwidth            [][]interface{} `export:"BlockIOReadBandwidth"`
	BlockIOWeight                   uint64          `export:"BlockIOWeight"`
	BlockIOWriteBandwidth           [][]interface{} `export:"BlockIOWriteBandwidth"`
	BusName                         string          `export:"BusName"`
	CPUAccounting                   bool            `export:"CPUAccounting"`
	CPUAffinity                     []uint8         `export:"CPUAffinity"`
	CPUQuotaPerSecUSec              uint64          `export:"CPUQuotaPerSecUSec"`
	CPUSchedulingPolicy             int32           `export:"CPUSchedulingPolicy"`
	CPUSchedulingPriority           int32           `export:"CPUSchedulingPriority"`
	CPUSchedulingResetOnFork        bool            `export:"CPUSchedulingResetOnFork"`
	CPUShares                       uint64          `export:"CPUShares"`
	CPUUsageNSec                    uint64          `export:"CPUUsageNSec"`
	Capabilities                    string          `export:"Capabilities"`
	CapabilityBoundingSet           uint64          `export:"CapabilityBoundingSet"`
	ControlGroup                    string          `export:"ControlGroup"`
	ControlPID                      uint32          `export:"ControlPID"`
	Delegate                        bool            `export:"Delegate"`
	DeviceAllow                     [][]interface{} `export:"DeviceAllow"`
	DevicePolicy                    string          `export:"DevicePolicy"`
	Environment                     []string        `export:"Environment"`
	EnvironmentFiles                [][]interface{} `export:"EnvironmentFiles"`
	ExecMainCode                    int32           `export:"ExecMainCode"`
	ExecMainExitTimestamp           uint64          `export:"ExecMainExitTimestamp"`
	ExecMainExitTimestampMonotonic  uint64          `export:"ExecMainExitTimestampMonotonic"`
	ExecMainPID                     uint32          `export:"ExecMainPID"`
	ExecMainStartTimestamp          uint64          `export:"ExecMainStartTimestamp"`
	ExecMainStartTimestampMonotonic uint64          `export:"ExecMainStartTimestampMonotonic"`
	ExecMainStatus                  int32           `export:"ExecMainStatus"`
	ExecReload                      [][]interface{} `export:"ExecReload"`
	ExecStart                       [][]interface{} `export:"ExecStart"`
	ExecStartPost                   [][]interface{} `export:"ExecStartPost"`
	ExecStartPre                    [][]interface{} `export:"ExecStartPre"`
	ExecStop                        [][]interface{} `export:"ExecStop"`
	ExecStopPost                    [][]interface{} `export:"ExecStopPost"`
	FailureAction                   string          `export:"FailureAction"`
	FileDescriptorStoreMax          uint32          `export:"FileDescriptorStoreMax"`
	Group                           string          `export:"Group"`
	GuessMainPID                    bool            `export:"GuessMainPID"`
	IOScheduling                    int32           `export:"IOScheduling"`
	IgnoreSIGPIPE                   bool            `export:"IgnoreSIGPIPE"`
	InaccessibleDirectories         []string        `export:"InaccessibleDirectories"`
	KillMode                        string          `export:"KillMode"`
	KillSignal                      int32           `export:"KillSignal"`
	LimitAS                         uint64          `export:"LimitAS"`
	LimitASSoft                     uint64          `export:"LimitASSoft"`
	LimitCORE                       uint64          `export:"LimitCORE"`
	LimitCORESoft                   uint64          `export:"LimitCORESoft"`
	LimitCPU                        uint64          `export:"LimitCPU"`
	LimitCPUSoft                    uint64          `export:"LimitCPUSoft"`
	LimitDATA                       uint64          `export:"LimitDATA"`
	LimitDATASoft                   uint64          `export:"LimitDATASoft"`
	LimitFSIZE                      uint64          `export:"LimitFSIZE"`
	LimitFSIZESoft                  uint64          `export:"LimitFSIZESoft"`
	LimitLOCKS                      uint64          `export:"LimitLOCKS"`
	LimitLOCKSSoft                  uint64          `export:"LimitLOCKSSoft"`
	LimitMEMLOCK                    uint64          `export:"LimitMEMLOCK"`
	LimitMEMLOCKSoft                uint64          `export:"LimitMEMLOCKSoft"`
	LimitMSGQUEUE                   uint64          `export:"LimitMSGQUEUE"`
	LimitMSGQUEUESoft               uint64          `export:"LimitMSGQUEUESoft"`
	LimitNICE                       uint64          `export:"LimitNICE"`
	LimitNICESoft                   uint64          `export:"LimitNICESoft"`
	LimitNOFILE                     uint64          `export:"LimitNOFILE"`
	LimitNOFILESoft                 uint64          `export:"LimitNOFILESoft"`
	LimitNPROC                      uint64          `export:"LimitNPROC"`
	LimitNPROCSoft                  uint64          `export:"LimitNPROCSoft"`
	LimitRSS                        uint64          `export:"LimitRSS"`
	LimitRSSSoft                    uint64          `export:"LimitRSSSoft"`
	LimitRTPRIO                     uint64          `export:"LimitRTPRIO"`
	LimitRTPRIOSoft                 uint64          `export:"LimitRTPRIOSoft"`
	LimitRTTIME                     uint64          `export:"LimitRTTIME"`
	LimitRTTIMESoft                 uint64          `export:"LimitRTTIMESoft"`
	LimitSIGPENDING                 uint64          `export:"LimitSIGPENDING"`
	LimitSIGPENDINGSoft             uint64          `export:"LimitSIGPENDINGSoft"`
	LimitSTACK                      uint64          `export:"LimitSTACK"`
	LimitSTACKSoft                  uint64          `export:"LimitSTACKSoft"`
	MainPID                         uint32          `export:"MainPID"`
	MemoryAccounting                bool            `export:"MemoryAccounting"`
	MemoryCurrent                   uint64          `export:"MemoryCurrent"`
	MemoryLimit                     uint64          `export:"MemoryLimit"`
	MountFlags                      uint64          `export:"MountFlags"`
	NFileDescriptorStore            uint32          `export:"NFileDescriptorStore"`
	Nice                            int32           `export:"Nice"`
	NoNewPrivileges                 bool            `export:"NoNewPrivileges"`
	NonBlocking                     bool            `export:"NonBlocking"`
	NotifyAccess                    string          `export:"NotifyAccess"`
	OOMScoreAdjust                  int32           `export:"OOMScoreAdjust"`
	PAMName                         string          `export:"PAMName"`
	PIDFile                         string          `export:"PIDFile"`
	PassEnvironment                 []string        `export:"PassEnvironment"`
	PermissionsStartOnly            bool            `export:"PermissionsStartOnly"`
	Personality                     string          `export:"Personality"`
	PrivateDevices                  bool            `export:"PrivateDevices"`
	PrivateNetwork                  bool            `export:"PrivateNetwork"`
	PrivateTmp                      bool            `export:"PrivateTmp"`
	ProtectHome                     string          `export:"ProtectHome"`
	ProtectSystem                   string          `export:"ProtectSystem"`
	ReadOnlyDirectories             []string        `export:"ReadOnlyDirectories"`
	ReadWriteDirectories            []string        `export:"ReadWriteDirectories"`
	RemainAfterExit                 bool            `export:"RemainAfterExit"`
	Restart                         string          `export:"Restart"`
	RestartUSec                     uint64          `export:"RestartUSec"`
	RestrictAddressFamilies         []interface{}   `export:"RestrictAddressFamilies"`
	Result                          string          `export:"Result"`
	RootDirectory                   string          `export:"RootDirectory"`
	RootDirectoryStartOnly          bool            `export:"RootDirectoryStartOnly"`
	RuntimeDirectory                []string        `export:"RuntimeDirectory"`
	RuntimeDirectoryMode            uint32          `export:"RuntimeDirectoryMode"`
	RuntimeMaxUSec                  uint64          `export:"RuntimeMaxUSec"`
	SELinuxContext                  []interface{}   `export:"SELinuxContext"`
	SameProcessGroup                bool            `export:"SameProcessGroup"`
	SecureBits                      int32           `export:"SecureBits"`
	SendSIGHUP                      bool            `export:"SendSIGHUP"`
	SendSIGKILL                     bool            `export:"SendSIGKILL"`
	Slice                           string          `export:"Slice"`
	SmackProcessLabel               []interface{}   `export:"SmackProcessLabel"`
	StandardError                   string          `export:"StandardError"`
	StandardInput                   string          `export:"StandardInput"`
	StandardOutput                  string          `export:"StandardOutput"`
	StartupBlockIOWeight            uint64          `export:"StartupBlockIOWeight"`
	StartupCPUShares                uint64          `export:"StartupCPUShares"`
	StatusErrno                     int32           `export:"StatusErrno"`
	StatusText                      string          `export:"StatusText"`
	SupplementaryGroups             []string        `export:"SupplementaryGroups"`
	SyslogFacility                  int32           `export:"SyslogFacility"`
	SyslogIdentifier                string          `export:"SyslogIdentifier"`
	SyslogLevel                     int32           `export:"SyslogLevel"`
	SyslogLevelPrefix               bool            `export:"SyslogLevelPrefix"`
	SyslogPriority                  int32           `export:"SyslogPriority"`
	SystemCallArchitectures         []string        `export:"SystemCallArchitectures"`
	SystemCallErrorNumber           int32           `export:"SystemCallErrorNumber"`
	SystemCallFilter                []interface{}   `export:"SystemCallFilter"`
	TTYPath                         string          `export:"TTYPath"`
	TTYReset                        bool            `export:"TTYReset"`
	TTYVHangup                      bool            `export:"TTYVHangup"`
	TTYVTDisallocate                bool            `export:"TTYVTDisallocate"`
	TasksAccounting                 bool            `export:"TasksAccounting"`
	TasksCurrent                    uint64          `export:"TasksCurrent"`
	TasksMax                        uint64          `export:"TasksMax"`
	TimeoutStartUSec                uint64          `export:"TimeoutStartUSec"`
	TimeoutStopUSec                 uint64          `export:"TimeoutStopUSec"`
	TimerSlackNSec                  uint64          `export:"TimerSlackNSec"`
	Type                            string          `export:"Type"`
	UMask                           uint32          `export:"UMask"`
	USBFunctionDescriptors          string          `export:"USBFunctionDescriptors"`
	USBFunctionStrings              string          `export:"USBFunctionStrings"`
	User                            string          `export:"User"`
	UtmpIdentifier                  string          `export:"UtmpIdentifier"`
	UtmpMode                        string          `export:"UtmpMode"`
	WatchdogTimestamp               uint64          `export:"WatchdogTimestamp"`
	WatchdogTimestampMonotonic      uint64          `export:"WatchdogTimestampMonotonic"`
	WatchdogUSec                    uint64          `export:"WatchdogUSec"`
	WorkingDirectory                string          `export:"WorkingDirectory"`
}

ServiceTypeProperties wraps the dbus api for system with properties from this unit type

type Signal

type Signal uint

Signal represents a Unix signal

var (
	// SIGHUP - terminal line hangup
	SIGHUP Signal = 1
	// SIGINT - interrupt program
	SIGINT Signal = 2
	// SIGQUIT - quit program
	SIGQUIT Signal = 3
	// SIGILL - illegal instruction
	SIGILL Signal = 4
	// SIGTRAP - trace trap
	SIGTRAP Signal = 5
	// SIGABRT - abort program (formerly SIGIOT)
	SIGABRT Signal = 6
	// SIGEMT - emulate instruction executed
	SIGEMT Signal = 7
	// SIGFPE - floating-point exception
	SIGFPE Signal = 8
	// SIGKILL - kill program
	SIGKILL Signal = 9
	// SIGBUS - bus error
	SIGBUS Signal = 10
	// SIGSEGV - segmentation violation
	SIGSEGV Signal = 11
	// SIGSYS - non-existent system call invoked
	SIGSYS Signal = 12
	// SIGPIPE - write on a pipe with no reader
	SIGPIPE Signal = 13
	// SIGALRM - real-time timer expired
	SIGALRM Signal = 14
	// SIGTERM - software termination signal
	SIGTERM Signal = 15
	// SIGURG - urgent condition present on socket
	SIGURG Signal = 16
	// SIGSTOP - stop (cannot be caught or ignored)
	SIGSTOP Signal = 17
	// SIGTSTP - stop signal generated from keyboard
	SIGTSTP Signal = 18
	// SIGCONT - continue after stop
	SIGCONT Signal = 19
	// SIGCHLD - child status has changed
	SIGCHLD Signal = 20
	// SIGTTIN - background read attempted from control terminal
	SIGTTIN Signal = 21
	// SIGTTOU - background write attempted to control terminal
	SIGTTOU Signal = 22
	// SIGIO - I/O is possible on a descriptor (see fcntl(2))
	SIGIO Signal = 23
	// SIGXCPU - cpu time limit exceeded (see setrlimit(2))
	SIGXCPU Signal = 24
	// SIGXFSZ - file size limit exceeded (see setrlimit(2))
	SIGXFSZ Signal = 25
	// SIGVTALRM - virtual time alarm (see setitimer(2))
	SIGVTALRM Signal = 26
	// SIGPROF - profiling timer alarm (see setitimer(2))
	SIGPROF Signal = 27
	// SIGWINCH - Window size change
	SIGWINCH Signal = 28
	// SIGINFO - status request from keyboard
	SIGINFO Signal = 29
	// SIGUSR1 - User defined signal 1
	SIGUSR1 Signal = 30
	// SIGUSR2 - User defined signal 2
	SIGUSR2 Signal = 31
)

func ParseSignalByName

func ParseSignalByName(s string) (Signal, error)

ParseSignalByName takes a string representing a signal name

func ParseSignalByNumber

func ParseSignalByNumber(n uint) (Signal, error)

ParseSignalByNumber takes a signal number and returns a Signal; it returns an error if the number is an invalid signal.

func (Signal) String

func (s Signal) String() string

type SliceTypeProperties

type SliceTypeProperties struct {
	BlockIOAccounting     bool            `export:"BlockIOAccounting"`
	BlockIODeviceWeight   [][]interface{} `export:"BlockIODeviceWeight"`
	BlockIOReadBandwidth  [][]interface{} `export:"BlockIOReadBandwidth"`
	BlockIOWeight         uint64          `export:"BlockIOWeight"`
	BlockIOWriteBandwidth [][]interface{} `export:"BlockIOWriteBandwidth"`
	CPUAccounting         bool            `export:"CPUAccounting"`
	CPUQuotaPerSecUSec    uint64          `export:"CPUQuotaPerSecUSec"`
	CPUShares             uint64          `export:"CPUShares"`
	CPUUsageNSec          uint64          `export:"CPUUsageNSec"`
	ControlGroup          string          `export:"ControlGroup"`
	Delegate              bool            `export:"Delegate"`
	DeviceAllow           [][]interface{} `export:"DeviceAllow"`
	DevicePolicy          string          `export:"DevicePolicy"`
	MemoryAccounting      bool            `export:"MemoryAccounting"`
	MemoryCurrent         uint64          `export:"MemoryCurrent"`
	MemoryLimit           uint64          `export:"MemoryLimit"`
	Slice                 string          `export:"Slice"`
	StartupBlockIOWeight  uint64          `export:"StartupBlockIOWeight"`
	StartupCPUShares      uint64          `export:"StartupCPUShares"`
	TasksAccounting       bool            `export:"TasksAccounting"`
	TasksCurrent          uint64          `export:"TasksCurrent"`
	TasksMax              uint64          `export:"TasksMax"`
}

SliceTypeProperties wraps the dbus api for system with properties from this unit type

type SocketTypeProperties

type SocketTypeProperties struct {
	Accept                   bool            `export:"Accept"`
	AmbientCapabilities      uint64          `export:"AmbientCapabilities"`
	AppArmorProfile          []interface{}   `export:"AppArmorProfile"`
	Backlog                  uint32          `export:"Backlog"`
	BindIPv6Only             string          `export:"BindIPv6Only"`
	BindToDevice             string          `export:"BindToDevice"`
	BlockIOAccounting        bool            `export:"BlockIOAccounting"`
	BlockIODeviceWeight      [][]interface{} `export:"BlockIODeviceWeight"`
	BlockIOReadBandwidth     [][]interface{} `export:"BlockIOReadBandwidth"`
	BlockIOWeight            uint64          `export:"BlockIOWeight"`
	BlockIOWriteBandwidth    [][]interface{} `export:"BlockIOWriteBandwidth"`
	Broadcast                bool            `export:"Broadcast"`
	CPUAccounting            bool            `export:"CPUAccounting"`
	CPUAffinity              []uint8         `export:"CPUAffinity"`
	CPUQuotaPerSecUSec       uint64          `export:"CPUQuotaPerSecUSec"`
	CPUSchedulingPolicy      int32           `export:"CPUSchedulingPolicy"`
	CPUSchedulingPriority    int32           `export:"CPUSchedulingPriority"`
	CPUSchedulingResetOnFork bool            `export:"CPUSchedulingResetOnFork"`
	CPUShares                uint64          `export:"CPUShares"`
	CPUUsageNSec             uint64          `export:"CPUUsageNSec"`
	Capabilities             string          `export:"Capabilities"`
	CapabilityBoundingSet    uint64          `export:"CapabilityBoundingSet"`
	ControlGroup             string          `export:"ControlGroup"`
	ControlPID               uint32          `export:"ControlPID"`
	DeferAcceptUSec          uint64          `export:"DeferAcceptUSec"`
	Delegate                 bool            `export:"Delegate"`
	DeviceAllow              [][]interface{} `export:"DeviceAllow"`
	DevicePolicy             string          `export:"DevicePolicy"`
	DirectoryMode            uint32          `export:"DirectoryMode"`
	Environment              []string        `export:"Environment"`
	EnvironmentFiles         [][]interface{} `export:"EnvironmentFiles"`
	ExecStartPost            [][]interface{} `export:"ExecStartPost"`
	ExecStartPre             [][]interface{} `export:"ExecStartPre"`
	ExecStopPost             [][]interface{} `export:"ExecStopPost"`
	ExecStopPre              [][]interface{} `export:"ExecStopPre"`
	FileDescriptorName       string          `export:"FileDescriptorName"`
	FreeBind                 bool            `export:"FreeBind"`
	Group                    string          `export:"Group"`
	IOScheduling             int32           `export:"IOScheduling"`
	IPTOS                    int32           `export:"IPTOS"`
	IPTTL                    int32           `export:"IPTTL"`
	IgnoreSIGPIPE            bool            `export:"IgnoreSIGPIPE"`
	InaccessibleDirectories  []string        `export:"InaccessibleDirectories"`
	KeepAlive                bool            `export:"KeepAlive"`
	KeepAliveIntervalUSec    uint64          `export:"KeepAliveIntervalUSec"`
	KeepAliveProbes          uint32          `export:"KeepAliveProbes"`
	KeepAliveTimeUSec        uint64          `export:"KeepAliveTimeUSec"`
	KillMode                 string          `export:"KillMode"`
	KillSignal               int32           `export:"KillSignal"`
	LimitAS                  uint64          `export:"LimitAS"`
	LimitASSoft              uint64          `export:"LimitASSoft"`
	LimitCORE                uint64          `export:"LimitCORE"`
	LimitCORESoft            uint64          `export:"LimitCORESoft"`
	LimitCPU                 uint64          `export:"LimitCPU"`
	LimitCPUSoft             uint64          `export:"LimitCPUSoft"`
	LimitDATA                uint64          `export:"LimitDATA"`
	LimitDATASoft            uint64          `export:"LimitDATASoft"`
	LimitFSIZE               uint64          `export:"LimitFSIZE"`
	LimitFSIZESoft           uint64          `export:"LimitFSIZESoft"`
	LimitLOCKS               uint64          `export:"LimitLOCKS"`
	LimitLOCKSSoft           uint64          `export:"LimitLOCKSSoft"`
	LimitMEMLOCK             uint64          `export:"LimitMEMLOCK"`
	LimitMEMLOCKSoft         uint64          `export:"LimitMEMLOCKSoft"`
	LimitMSGQUEUE            uint64          `export:"LimitMSGQUEUE"`
	LimitMSGQUEUESoft        uint64          `export:"LimitMSGQUEUESoft"`
	LimitNICE                uint64          `export:"LimitNICE"`
	LimitNICESoft            uint64          `export:"LimitNICESoft"`
	LimitNOFILE              uint64          `export:"LimitNOFILE"`
	LimitNOFILESoft          uint64          `export:"LimitNOFILESoft"`
	LimitNPROC               uint64          `export:"LimitNPROC"`
	LimitNPROCSoft           uint64          `export:"LimitNPROCSoft"`
	LimitRSS                 uint64          `export:"LimitRSS"`
	LimitRSSSoft             uint64          `export:"LimitRSSSoft"`
	LimitRTPRIO              uint64          `export:"LimitRTPRIO"`
	LimitRTPRIOSoft          uint64          `export:"LimitRTPRIOSoft"`
	LimitRTTIME              uint64          `export:"LimitRTTIME"`
	LimitRTTIMESoft          uint64          `export:"LimitRTTIMESoft"`
	LimitSIGPENDING          uint64          `export:"LimitSIGPENDING"`
	LimitSIGPENDINGSoft      uint64          `export:"LimitSIGPENDINGSoft"`
	LimitSTACK               uint64          `export:"LimitSTACK"`
	LimitSTACKSoft           uint64          `export:"LimitSTACKSoft"`
	Listen                   [][]interface{} `export:"Listen"`
	Mark                     int32           `export:"Mark"`
	MaxConnections           uint32          `export:"MaxConnections"`
	MemoryAccounting         bool            `export:"MemoryAccounting"`
	MemoryCurrent            uint64          `export:"MemoryCurrent"`
	MemoryLimit              uint64          `export:"MemoryLimit"`
	MessageQueueMaxMessages  int64           `export:"MessageQueueMaxMessages"`
	MessageQueueMessageSize  int64           `export:"MessageQueueMessageSize"`
	MountFlags               uint64          `export:"MountFlags"`
	NAccepted                uint32          `export:"NAccepted"`
	NConnections             uint32          `export:"NConnections"`
	Nice                     int32           `export:"Nice"`
	NoDelay                  bool            `export:"NoDelay"`
	NoNewPrivileges          bool            `export:"NoNewPrivileges"`
	NonBlocking              bool            `export:"NonBlocking"`
	OOMScoreAdjust           int32           `export:"OOMScoreAdjust"`
	PAMName                  string          `export:"PAMName"`
	PassCredentials          bool            `export:"PassCredentials"`
	PassEnvironment          []string        `export:"PassEnvironment"`
	PassSecurity             bool            `export:"PassSecurity"`
	Personality              string          `export:"Personality"`
	PipeSize                 uint64          `export:"PipeSize"`
	Priority                 int32           `export:"Priority"`
	PrivateDevices           bool            `export:"PrivateDevices"`
	PrivateNetwork           bool            `export:"PrivateNetwork"`
	PrivateTmp               bool            `export:"PrivateTmp"`
	ProtectHome              string          `export:"ProtectHome"`
	ProtectSystem            string          `export:"ProtectSystem"`
	ReadOnlyDirectories      []string        `export:"ReadOnlyDirectories"`
	ReadWriteDirectories     []string        `export:"ReadWriteDirectories"`
	ReceiveBuffer            uint64          `export:"ReceiveBuffer"`
	RemoveOnStop             bool            `export:"RemoveOnStop"`
	RestrictAddressFamilies  []interface{}   `export:"RestrictAddressFamilies"`
	Result                   string          `export:"Result"`
	ReusePort                bool            `export:"ReusePort"`
	RootDirectory            string          `export:"RootDirectory"`
	RuntimeDirectory         []string        `export:"RuntimeDirectory"`
	RuntimeDirectoryMode     uint32          `export:"RuntimeDirectoryMode"`
	SELinuxContext           []interface{}   `export:"SELinuxContext"`
	SameProcessGroup         bool            `export:"SameProcessGroup"`
	SecureBits               int32           `export:"SecureBits"`
	SendBuffer               uint64          `export:"SendBuffer"`
	SendSIGHUP               bool            `export:"SendSIGHUP"`
	SendSIGKILL              bool            `export:"SendSIGKILL"`
	Slice                    string          `export:"Slice"`
	SmackLabel               string          `export:"SmackLabel"`
	SmackLabelIPIn           string          `export:"SmackLabelIPIn"`
	SmackLabelIPOut          string          `export:"SmackLabelIPOut"`
	SmackProcessLabel        []interface{}   `export:"SmackProcessLabel"`
	SocketGroup              string          `export:"SocketGroup"`
	SocketMode               uint32          `export:"SocketMode"`
	SocketProtocol           int32           `export:"SocketProtocol"`
	SocketUser               string          `export:"SocketUser"`
	StandardError            string          `export:"StandardError"`
	StandardInput            string          `export:"StandardInput"`
	StandardOutput           string          `export:"StandardOutput"`
	StartupBlockIOWeight     uint64          `export:"StartupBlockIOWeight"`
	StartupCPUShares         uint64          `export:"StartupCPUShares"`
	SupplementaryGroups      []string        `export:"SupplementaryGroups"`
	Symlinks                 []string        `export:"Symlinks"`
	SyslogFacility           int32           `export:"SyslogFacility"`
	SyslogIdentifier         string          `export:"SyslogIdentifier"`
	SyslogLevel              int32           `export:"SyslogLevel"`
	SyslogLevelPrefix        bool            `export:"SyslogLevelPrefix"`
	SyslogPriority           int32           `export:"SyslogPriority"`
	SystemCallArchitectures  []string        `export:"SystemCallArchitectures"`
	SystemCallErrorNumber    int32           `export:"SystemCallErrorNumber"`
	SystemCallFilter         []interface{}   `export:"SystemCallFilter"`
	TTYPath                  string          `export:"TTYPath"`
	TTYReset                 bool            `export:"TTYReset"`
	TTYVHangup               bool            `export:"TTYVHangup"`
	TTYVTDisallocate         bool            `export:"TTYVTDisallocate"`
	TasksAccounting          bool            `export:"TasksAccounting"`
	TasksCurrent             uint64          `export:"TasksCurrent"`
	TasksMax                 uint64          `export:"TasksMax"`
	TimeoutUSec              uint64          `export:"TimeoutUSec"`
	TimerSlackNSec           uint64          `export:"TimerSlackNSec"`
	Transparent              bool            `export:"Transparent"`
	TriggerLimitBurst        uint32          `export:"TriggerLimitBurst"`
	TriggerLimitIntervalSec  uint64          `export:"TriggerLimitIntervalSec"`
	UMask                    uint32          `export:"UMask"`
	User                     string          `export:"User"`
	UtmpIdentifier           string          `export:"UtmpIdentifier"`
	UtmpMode                 string          `export:"UtmpMode"`
	WorkingDirectory         string          `export:"WorkingDirectory"`
	Writable                 bool            `export:"Writable"`
}

SocketTypeProperties wraps the dbus api for system with properties from this unit type

type SwapTypeProperties

type SwapTypeProperties struct {
	AmbientCapabilities      uint64          `export:"AmbientCapabilities"`
	AppArmorProfile          []interface{}   `export:"AppArmorProfile"`
	BlockIOAccounting        bool            `export:"BlockIOAccounting"`
	BlockIODeviceWeight      [][]interface{} `export:"BlockIODeviceWeight"`
	BlockIOReadBandwidth     [][]interface{} `export:"BlockIOReadBandwidth"`
	BlockIOWeight            uint64          `export:"BlockIOWeight"`
	BlockIOWriteBandwidth    [][]interface{} `export:"BlockIOWriteBandwidth"`
	CPUAccounting            bool            `export:"CPUAccounting"`
	CPUAffinity              []uint8         `export:"CPUAffinity"`
	CPUQuotaPerSecUSec       uint64          `export:"CPUQuotaPerSecUSec"`
	CPUSchedulingPolicy      int32           `export:"CPUSchedulingPolicy"`
	CPUSchedulingPriority    int32           `export:"CPUSchedulingPriority"`
	CPUSchedulingResetOnFork bool            `export:"CPUSchedulingResetOnFork"`
	CPUShares                uint64          `export:"CPUShares"`
	CPUUsageNSec             uint64          `export:"CPUUsageNSec"`
	Capabilities             string          `export:"Capabilities"`
	CapabilityBoundingSet    uint64          `export:"CapabilityBoundingSet"`
	ControlGroup             string          `export:"ControlGroup"`
	ControlPID               uint32          `export:"ControlPID"`
	Delegate                 bool            `export:"Delegate"`
	DeviceAllow              [][]interface{} `export:"DeviceAllow"`
	DevicePolicy             string          `export:"DevicePolicy"`
	Environment              []string        `export:"Environment"`
	EnvironmentFiles         [][]interface{} `export:"EnvironmentFiles"`
	ExecActivate             [][]interface{} `export:"ExecActivate"`
	ExecDeactivate           [][]interface{} `export:"ExecDeactivate"`
	Group                    string          `export:"Group"`
	IOScheduling             int32           `export:"IOScheduling"`
	IgnoreSIGPIPE            bool            `export:"IgnoreSIGPIPE"`
	InaccessibleDirectories  []string        `export:"InaccessibleDirectories"`
	KillMode                 string          `export:"KillMode"`
	KillSignal               int32           `export:"KillSignal"`
	LimitAS                  uint64          `export:"LimitAS"`
	LimitASSoft              uint64          `export:"LimitASSoft"`
	LimitCORE                uint64          `export:"LimitCORE"`
	LimitCORESoft            uint64          `export:"LimitCORESoft"`
	LimitCPU                 uint64          `export:"LimitCPU"`
	LimitCPUSoft             uint64          `export:"LimitCPUSoft"`
	LimitDATA                uint64          `export:"LimitDATA"`
	LimitDATASoft            uint64          `export:"LimitDATASoft"`
	LimitFSIZE               uint64          `export:"LimitFSIZE"`
	LimitFSIZESoft           uint64          `export:"LimitFSIZESoft"`
	LimitLOCKS               uint64          `export:"LimitLOCKS"`
	LimitLOCKSSoft           uint64          `export:"LimitLOCKSSoft"`
	LimitMEMLOCK             uint64          `export:"LimitMEMLOCK"`
	LimitMEMLOCKSoft         uint64          `export:"LimitMEMLOCKSoft"`
	LimitMSGQUEUE            uint64          `export:"LimitMSGQUEUE"`
	LimitMSGQUEUESoft        uint64          `export:"LimitMSGQUEUESoft"`
	LimitNICE                uint64          `export:"LimitNICE"`
	LimitNICESoft            uint64          `export:"LimitNICESoft"`
	LimitNOFILE              uint64          `export:"LimitNOFILE"`
	LimitNOFILESoft          uint64          `export:"LimitNOFILESoft"`
	LimitNPROC               uint64          `export:"LimitNPROC"`
	LimitNPROCSoft           uint64          `export:"LimitNPROCSoft"`
	LimitRSS                 uint64          `export:"LimitRSS"`
	LimitRSSSoft             uint64          `export:"LimitRSSSoft"`
	LimitRTPRIO              uint64          `export:"LimitRTPRIO"`
	LimitRTPRIOSoft          uint64          `export:"LimitRTPRIOSoft"`
	LimitRTTIME              uint64          `export:"LimitRTTIME"`
	LimitRTTIMESoft          uint64          `export:"LimitRTTIMESoft"`
	LimitSIGPENDING          uint64          `export:"LimitSIGPENDING"`
	LimitSIGPENDINGSoft      uint64          `export:"LimitSIGPENDINGSoft"`
	LimitSTACK               uint64          `export:"LimitSTACK"`
	LimitSTACKSoft           uint64          `export:"LimitSTACKSoft"`
	MemoryAccounting         bool            `export:"MemoryAccounting"`
	MemoryCurrent            uint64          `export:"MemoryCurrent"`
	MemoryLimit              uint64          `export:"MemoryLimit"`
	MountFlags               uint64          `export:"MountFlags"`
	Nice                     int32           `export:"Nice"`
	NoNewPrivileges          bool            `export:"NoNewPrivileges"`
	NonBlocking              bool            `export:"NonBlocking"`
	OOMScoreAdjust           int32           `export:"OOMScoreAdjust"`
	Options                  string          `export:"Options"`
	PAMName                  string          `export:"PAMName"`
	PassEnvironment          []string        `export:"PassEnvironment"`
	Personality              string          `export:"Personality"`
	Priority                 int32           `export:"Priority"`
	PrivateDevices           bool            `export:"PrivateDevices"`
	PrivateNetwork           bool            `export:"PrivateNetwork"`
	PrivateTmp               bool            `export:"PrivateTmp"`
	ProtectHome              string          `export:"ProtectHome"`
	ProtectSystem            string          `export:"ProtectSystem"`
	ReadOnlyDirectories      []string        `export:"ReadOnlyDirectories"`
	ReadWriteDirectories     []string        `export:"ReadWriteDirectories"`
	RestrictAddressFamilies  []interface{}   `export:"RestrictAddressFamilies"`
	Result                   string          `export:"Result"`
	RootDirectory            string          `export:"RootDirectory"`
	RuntimeDirectory         []string        `export:"RuntimeDirectory"`
	RuntimeDirectoryMode     uint32          `export:"RuntimeDirectoryMode"`
	SELinuxContext           []interface{}   `export:"SELinuxContext"`
	SameProcessGroup         bool            `export:"SameProcessGroup"`
	SecureBits               int32           `export:"SecureBits"`
	SendSIGHUP               bool            `export:"SendSIGHUP"`
	SendSIGKILL              bool            `export:"SendSIGKILL"`
	Slice                    string          `export:"Slice"`
	SmackProcessLabel        []interface{}   `export:"SmackProcessLabel"`
	StandardError            string          `export:"StandardError"`
	StandardInput            string          `export:"StandardInput"`
	StandardOutput           string          `export:"StandardOutput"`
	StartupBlockIOWeight     uint64          `export:"StartupBlockIOWeight"`
	StartupCPUShares         uint64          `export:"StartupCPUShares"`
	SupplementaryGroups      []string        `export:"SupplementaryGroups"`
	SyslogFacility           int32           `export:"SyslogFacility"`
	SyslogIdentifier         string          `export:"SyslogIdentifier"`
	SyslogLevel              int32           `export:"SyslogLevel"`
	SyslogLevelPrefix        bool            `export:"SyslogLevelPrefix"`
	SyslogPriority           int32           `export:"SyslogPriority"`
	SystemCallArchitectures  []string        `export:"SystemCallArchitectures"`
	SystemCallErrorNumber    int32           `export:"SystemCallErrorNumber"`
	SystemCallFilter         []interface{}   `export:"SystemCallFilter"`
	TTYPath                  string          `export:"TTYPath"`
	TTYReset                 bool            `export:"TTYReset"`
	TTYVHangup               bool            `export:"TTYVHangup"`
	TTYVTDisallocate         bool            `export:"TTYVTDisallocate"`
	TasksAccounting          bool            `export:"TasksAccounting"`
	TasksCurrent             uint64          `export:"TasksCurrent"`
	TasksMax                 uint64          `export:"TasksMax"`
	TimeoutUSec              uint64          `export:"TimeoutUSec"`
	TimerSlackNSec           uint64          `export:"TimerSlackNSec"`
	UMask                    uint32          `export:"UMask"`
	User                     string          `export:"User"`
	UtmpIdentifier           string          `export:"UtmpIdentifier"`
	UtmpMode                 string          `export:"UtmpMode"`
	What                     string          `export:"What"`
	WorkingDirectory         string          `export:"WorkingDirectory"`
}

SwapTypeProperties wraps the dbus api for system with properties from this unit type

type SystemdConnection

type SystemdConnection interface {
	// Close a systemd connection
	Close()

	// ListUnits that are currently loaded
	ListUnits() ([]dbus.UnitStatus, error)

	// ListUnitsByNames that they are known by
	ListUnitsByNames(units []string) ([]dbus.UnitStatus, error)

	// GetUnitProperties that are global to all unit types
	GetUnitProperties(unit string) (map[string]interface{}, error)

	// GetUnitTypeProperties that are specific to the specified unit type
	GetUnitTypeProperties(unit, unitType string) (map[string]interface{}, error)

	// StartUnit starts a unit
	StartUnit(name string, mode string, ch chan<- string) (int, error)

	// StopUnit stops a unit
	StopUnit(name string, mode string, ch chan<- string) (int, error)

	// RestartUnit restarts a unit
	RestartUnit(name string, mode string, ch chan<- string) (int, error)

	// ReloadUnit instructs a unit to reload it's configuration file
	ReloadUnit(name string, mode string, ch chan<- string) (int, error)

	// KillUnit sends a unix signal to the process
	KillUnit(name string, signal int32)
}

SystemdConnection is a lightweight mock over *dbus.Connection

type SystemdExecutor

type SystemdExecutor interface {
	// ListUnits will return a Unit slice
	ListUnits() ([]*Unit, error)

	// QueryUnit will construct a Unit from the given unit name.  If verify is
	// true, the name will be compared against the currently loaded units by
	// calling ListUnits.  This is slower but offers some additional guarantees
	// since the underlying dbus API will return a result even for nonexistant
	// unit names.
	QueryUnit(unitName string, verify bool) (*Unit, error)

	// StartUnit will start a systemd unit, replacing any currently pending
	// operations on that unit.
	StartUnit(*Unit) error

	// StopUnit will stop a systemd unit, replacing any currently pending
	// operations on that unit.
	StopUnit(*Unit) error

	// Restart unit will restart a running unit, or start it if it's not currently
	// running.  This will replace any currently pending operations on that unit.
	RestartUnit(*Unit) error

	// ReloadUnit will instruct a unit to reload it's configuration file. This
	// will only work on systemd-aware processes.
	ReloadUnit(*Unit) error

	// Send a unix signal to a process.
	SendSignal(u *Unit, signal Signal)
}

SystemdExecutor is a lightweight interface to support mocking systemd

func NewSystemExecutor

func NewSystemExecutor() SystemdExecutor

NewSystemExecutor will generate a new real executor

type TargetTypeProperties

type TargetTypeProperties struct {
}

TargetTypeProperties wraps the dbus api for system with properties from this unit type

type TimerTypeProperties

type TimerTypeProperties struct {
	AccuracyUSec             uint64          `export:"AccuracyUSec"`
	LastTriggerUSec          uint64          `export:"LastTriggerUSec"`
	LastTriggerUSecMonotonic uint64          `export:"LastTriggerUSecMonotonic"`
	NextElapseUSecMonotonic  uint64          `export:"NextElapseUSecMonotonic"`
	NextElapseUSecRealtime   uint64          `export:"NextElapseUSecRealtime"`
	Persistent               bool            `export:"Persistent"`
	RandomizedDelayUSec      uint64          `export:"RandomizedDelayUSec"`
	RemainAfterElapse        bool            `export:"RemainAfterElapse"`
	Result                   string          `export:"Result"`
	TimersCalendar           [][]interface{} `export:"TimersCalendar"`
	TimersMonotonic          [][]interface{} `export:"TimersMonotonic"`
	Unit                     string          `export:"Unit"`
	WakeSystem               bool            `export:"WakeSystem"`
}

TimerTypeProperties wraps the dbus api for system with properties from this unit type

type Unit

type Unit struct {
	// the global embedded properties of the unit
	Properties

	// the name of the unit
	Name string

	// the description of the unit
	Description string

	// the units current active state
	ActiveState string

	// the units current load state
	LoadState string

	// the path to the unit file, if any
	Path string

	// the type of unit file
	Type UnitType

	// ServiceProperties contain properties specific to Service unit types
	ServiceProperties *ServiceTypeProperties `export:"service_properties"`

	// SocketProperties contain properties specific to Socket unit types
	SocketProperties *SocketTypeProperties `export:"SocketProperties"`

	// DeviceProperties contain properties specific to Device unit types
	DeviceProperties *DeviceTypeProperties `export:"DeviceProperties"`

	// MountProperties contain properties specific to Mount unit types
	MountProperties *MountTypeProperties `export:"MountProperties"`

	// AutomountProperties contain properties specific for Autoumount unit types
	AutomountProperties *AutomountTypeProperties `export:"AutomountProperties"`

	// SwapProperties contain properties specific to Swap unit types
	SwapProperties *SwapTypeProperties `export:"SwapProperties"`

	// PathProperties contain properties specific to Path unit types
	PathProperties *PathTypeProperties `export:"PathProperties"`

	// TimerProperties contain properties specific to Timer unit types
	TimerProperties *TimerTypeProperties `export:"TimerProperties"`

	// SliceProperties contain properties specific to Slice unit types
	SliceProperties *SliceTypeProperties `export:"SliceProperties"`

	// ScopeProperties contain properties specific to Scope unit types
	ScopeProperties *ScopeTypeProperties `export:"ScopeProperties"`
}

Unit represents a systemd unit

func (*Unit) IsServiceUnit

func (u *Unit) IsServiceUnit() bool

IsServiceUnit returns true if the unit is a service

func (*Unit) SetProperties

func (u *Unit) SetProperties(m map[string]interface{})

SetProperties sets the global properties of a unit from a properties map

func (*Unit) SetTypedProperties

func (u *Unit) SetTypedProperties(m map[string]interface{})

SetTypedProperties sets type specific properties of a unit from a map

type UnitType

type UnitType uint

UnitType provides an enumeration over the different types of systemd unit file types

const (
	// UnitTypeUnknown represents a generic or unknown unit type
	UnitTypeUnknown UnitType = iota

	// UnitTypeService represents a systemd.service(5)
	UnitTypeService UnitType = iota

	// UnitTypeSocket represents a systemd.socket(5)
	UnitTypeSocket UnitType = iota

	// UnitTypeDevice represents a systemd.device(5)
	UnitTypeDevice UnitType = iota

	// UnitTypeMount represents a systemd.mount(5)
	UnitTypeMount UnitType = iota

	// UnitTypeAutoMount represents a systemd.automount(5)
	UnitTypeAutoMount UnitType = iota

	// UnitTypeSwap represents a systemd.swap(5)
	UnitTypeSwap UnitType = iota

	// UnitTypeTarget represents a systemd.target(5)
	UnitTypeTarget UnitType = iota

	// UnitTypePath represents a systemd.path(5)
	UnitTypePath UnitType = iota

	// UnitTypeTimer represents a systemd.timer(5)
	UnitTypeTimer UnitType = iota

	// UnitTypeSnapshot represents a systemd.snapshot(5)
	UnitTypeSnapshot UnitType = iota

	// UnitTypeSlice represents a systemd.slice(5)
	UnitTypeSlice UnitType = iota

	// UnitTypeScope represents a systemd.scope(5)
	UnitTypeScope UnitType = iota
)

func UnitTypeFromName

func UnitTypeFromName(s string) UnitType

UnitTypeFromName takes a service name in the form of "foo.service" and returns an appropriate UnitType representing that service type. If the service type isn't recognized from the suffix then UnitTypeUnknown is returned.

func (UnitType) HasProperties

func (u UnitType) HasProperties() bool

HasProperties returns true if the unit type has type-specific properties

func (UnitType) String

func (u UnitType) String() string

String provides a stringified-version of the type

func (UnitType) Suffix

func (u UnitType) Suffix() string

Suffix is the dual of UnitTypeFromName and generates the correct unit file suffix based on the type

func (UnitType) UnitTypeString

func (u UnitType) UnitTypeString() string

UnitTypeString returns a stringified version of the unit type, in title case

Jump to

Keyboard shortcuts

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