servicemgr

package
v1.8.20 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceName added in v1.8.20

func GetServiceName(name string) string

func IsEnabled added in v1.8.20

func IsEnabled(ctx context.Context, service string) (state string, err error)

func ListDependencies added in v1.8.20

func ListDependencies(ctx context.Context, service string, reverse ...bool) (result string, err error)

func ReadCmdOutput

func ReadCmdOutput(cmd *exec.Cmd, callback func(rd io.Reader) error) error

func ServiceLog

func ServiceLog(ctx context.Context, service string, callback func(rd io.Reader) error, follow ...bool) error

func ServiceLogClear added in v1.8.20

func ServiceLogClear(ctx context.Context) error

func ServiceLogWithRows added in v1.8.20

func ServiceLogWithRows(ctx context.Context, service string, lines uint, callback func(rd io.Reader) error, follow ...bool) error

Types

type Client added in v1.8.20

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

Client represents systemd D-Bus API client.

func NewClient added in v1.8.20

func NewClient(ctx context.Context) (*Client, error)

func (*Client) Close added in v1.8.20

func (c *Client) Close() error

func (*Client) Disable added in v1.8.20

func (c *Client) Disable(ctx context.Context, name string) error

func (*Client) Enable added in v1.8.20

func (c *Client) Enable(ctx context.Context, name string) error

func (*Client) List added in v1.8.20

func (c *Client) List(ctx context.Context, states []string, patterns []string) ([]*Service, error)

func (*Client) ListFiles added in v1.8.20

func (c *Client) ListFiles(ctx context.Context, names []string) ([]dbus.UnitFile, error)

func (*Client) Reload added in v1.8.20

func (c *Client) Reload(ctx context.Context) error

Reload instructs systemd to scan for and reload unit files. This is equivalent to a 'systemctl daemon-reload'.

func (*Client) ReloadOrRestart added in v1.8.20

func (c *Client) ReloadOrRestart(ctx context.Context, name string) error

func (*Client) ReloadUnit added in v1.8.20

func (c *Client) ReloadUnit(ctx context.Context, name string) error

func (*Client) Restart added in v1.8.20

func (c *Client) Restart(ctx context.Context, name string) error

func (*Client) SetRuntime added in v1.8.20

func (c *Client) SetRuntime(runtime bool)

func (*Client) Start added in v1.8.20

func (c *Client) Start(ctx context.Context, name string) error

func (*Client) Stop added in v1.8.20

func (c *Client) Stop(ctx context.Context, name string) error

type Service

type Service struct {
	Name        string
	Load        string
	Active      string
	Sub         string
	Description string

	// units file path and type
	Type string
	Path string
}

func List

func List(ctx context.Context) (r []*Service, e error)

func Parse

func Parse(line string) *Service

type ServiceConf added in v1.8.20

type ServiceConf struct {
	dbus.UnitFile
	Content string
}

func ServiceConfFileWithContent added in v1.8.20

func ServiceConfFileWithContent(items []dbus.UnitFile) []ServiceConf

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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