systemd

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 11 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 DaemonReload

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

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 GetUptimeWithCommand added in v0.13.0

func GetUptimeWithCommand(service, command string) (*time.Duration, error)

GetUptimeWithCommand uses the same command prefix as IsActiveWithCommand.

func GetVersion added in v0.5.0

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

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

func IsActive

func IsActive(service string) (bool, error)

IsActive returns true if the systemd service is active. TODO: deprecate this

func IsActiveWithCommand added in v0.13.0

func IsActiveWithCommand(service, command string) (bool, error)

IsActiveWithCommand accepts an optional systemctl command prefix for host queries.

func NotifyReady added in v0.5.0

func NotifyReady(_ context.Context) error

NotifyReady notifies systemd that the daemon is ready to serve requests. It also unsets NOTIFY_SOCKET from the process environment to prevent child processes from inheriting it and sending spurious notifications. ref. https://github.com/leptonai/gpud/issues/1215

func NotifyStopping added in v0.5.0

func NotifyStopping(_ context.Context) error

NotifyStopping notifies systemd that the daemon is about to be stopped.

func SystemctlExists

func SystemctlExists() bool

func SystemdExists

func SystemdExists() bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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