systemctl

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner interface {
	Run(args ...string) error
	RunQuiet(args ...string) error
}

Runner is the subset of environment.GuestActions that Systemctl requires. Using a narrow interface makes Systemctl easier to test and more loosely coupled.

type Systemctl

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

Systemctl provides a typed wrapper for running systemctl commands in the guest VM.

func New

func New(guest Runner) Systemctl

New creates a new Systemctl instance backed by the given guest.

func (Systemctl) Active

func (s Systemctl) Active(service string) bool

Active returns whether a systemd service is currently active.

func (Systemctl) DaemonReload

func (s Systemctl) DaemonReload() error

DaemonReload reloads the systemd manager configuration.

func (Systemctl) Restart

func (s Systemctl) Restart(service string) error

Restart restarts a systemd service.

func (Systemctl) Start

func (s Systemctl) Start(service string) error

Start starts a systemd service.

func (Systemctl) Stop

func (s Systemctl) Stop(service string, force bool) error

Stop stops a systemd service. If force is true, it is killed immediately without graceful shutdown.

Jump to

Keyboard shortcuts

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