systemd

package
v0.0.0-...-11103e6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestMain

func TestMain(m *testing.M)

TestMain sets up the test environment and skips tests if not on Linux

Types

type LogEntry

type LogEntry struct {
	// Timestamp of the log entry as a string
	Timestamp string
	// Message content
	Message string
	// Unit name that generated the log
	UnitName string
}

func (LogEntry) String

func (e LogEntry) String() string

type ServiceMetrics

type ServiceMetrics struct {
	// CPU usage as percentage of a single core (can exceed 100% if using multiple cores)
	CPUUsage float64
	// Memory usage in bytes
	MemoryUsage uint64
}

type SystemdService

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

func NewSystemdService

func NewSystemdService(logger *slog.Logger) (*SystemdService, error)

func (*SystemdService) GetUnitDetails

func (s *SystemdService) GetUnitDetails(name string) (*types.SystemdServiceDetails, error)

func (*SystemdService) ListUnits

func (s *SystemdService) ListUnits() (*types.SystemdServiceList, error)

func (*SystemdService) RestartUnit

func (s *SystemdService) RestartUnit(name string) error

func (*SystemdService) StartUnit

func (s *SystemdService) StartUnit(name string) error

func (*SystemdService) StopUnit

func (s *SystemdService) StopUnit(name string) error

func (*SystemdService) StreamServiceLogs

func (s *SystemdService) StreamServiceLogs(ctx context.Context, unitName string, follow bool, numLines int) (<-chan string, <-chan error)

StreamServiceLogs retrieves the last numLines log entries for the specified unit and then continues streaming new logs as they arrive The follow parameter is ignored - we always stream real-time updates

Jump to

Keyboard shortcuts

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