systemd

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package systemd provides the common systemd helper functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckVersion

func CheckVersion() (string, []string, error)

CheckVersion returns the systemd version by running `systemd --version`.

func DaemonReload

func DaemonReload(ctx context.Context) ([]byte, error)

func GetLatestJournalctlOutput added in v0.0.2

func GetLatestJournalctlOutput(ctx context.Context, svcName string) (string, error)

Fetches the latest/recent journal outputs using "journalctl". Equivalent to "journalctl -xeu [service name].service --no-pager".

func GetUptime

func GetUptime(service string) (*time.Duration, error)

GetUptime returns the uptime duration of the systemd service. Returns nil if the service is not found (thus uptime is not applicable, "n/a"). ref. https://github.com/kubernetes/node-problem-detector/blob/c4e5400ed6d7ca30d3a803248ae5b55c53557e59/pkg/healthchecker/health_checker_linux.go

func IsActive

func IsActive(service string) (bool, error)

IsActive returns true if the systemd service is active.

func JournalctlExists added in v0.0.2

func JournalctlExists() bool

func SystemctlExists

func SystemctlExists() bool

func SystemdExists

func SystemdExists() bool

Types

type DbusConn

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

func NewDbusConn

func NewDbusConn(ctx context.Context) (*DbusConn, error)

Caller should explicitly close the connection by calling Close() on returned connection object

func (*DbusConn) Close

func (c *DbusConn) Close()

func (*DbusConn) IsActive

func (c *DbusConn) IsActive(ctx context.Context, unitName string) (bool, error)

Jump to

Keyboard shortcuts

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