initsystem

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package initsystem provides an abstraction over several supported init systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host added in v0.3.0

type Host interface {
	Execf(cmd string, args ...any) error
	ExecOutputf(cmd string, args ...any) (string, error)
	Sudo(cmd string) (string, error)
}

Host interface for init system

type OpenRC

type OpenRC struct{}

OpenRC is found on some linux systems, often installed on Alpine for example.

func (OpenRC) DaemonReload

func (i OpenRC) DaemonReload(_ Host) error

DaemonReload reloads init system configuration

func (OpenRC) DisableService

func (i OpenRC) DisableService(h Host, s string) error

DisableService disables a service

func (OpenRC) EnableService

func (i OpenRC) EnableService(h Host, s string) error

EnableService enables a service

func (OpenRC) RestartService

func (i OpenRC) RestartService(h Host, s string) error

RestartService restarts a service

func (OpenRC) ServiceEnvironmentContent added in v0.3.24

func (i OpenRC) ServiceEnvironmentContent(env map[string]string) string

ServiceEnvironmentContent returns a formatted string for a service environment override file

func (OpenRC) ServiceEnvironmentPath added in v0.3.24

func (i OpenRC) ServiceEnvironmentPath(_ Host, s string) (string, error)

ServiceEnvironmentPath returns a path to an environment override file path

func (OpenRC) ServiceIsRunning

func (i OpenRC) ServiceIsRunning(h Host, s string) bool

ServiceIsRunning returns true if a service is running

func (OpenRC) ServiceScriptPath

func (i OpenRC) ServiceScriptPath(h Host, s string) (string, error)

ServiceScriptPath returns the path to a service configuration file

func (OpenRC) StartService

func (i OpenRC) StartService(h Host, s string) error

StartService starts a service

func (OpenRC) StopService

func (i OpenRC) StopService(h Host, s string) error

StopService stops a service

type Systemd

type Systemd struct{}

Systemd is found by default on most linux distributions today

func (Systemd) DaemonReload

func (i Systemd) DaemonReload(h Host) error

DaemonReload reloads init system configuration

func (Systemd) DisableService

func (i Systemd) DisableService(h Host, s string) error

DisableService disables a service

func (Systemd) EnableService

func (i Systemd) EnableService(h Host, s string) error

EnableService enables a service

func (Systemd) RestartService

func (i Systemd) RestartService(h Host, s string) error

RestartService restarts a service

func (Systemd) ServiceEnvironmentContent added in v0.3.24

func (i Systemd) ServiceEnvironmentContent(env map[string]string) string

ServiceEnvironmentContent returns a formatted string for a service environment override file

func (Systemd) ServiceEnvironmentPath added in v0.3.24

func (i Systemd) ServiceEnvironmentPath(h Host, s string) (string, error)

ServiceEnvironmentPath returns a path to an environment override file path

func (Systemd) ServiceIsRunning

func (i Systemd) ServiceIsRunning(h Host, s string) bool

ServiceIsRunning returns true if a service is running

func (Systemd) ServiceScriptPath

func (i Systemd) ServiceScriptPath(h Host, s string) (string, error)

ServiceScriptPath returns the path to a service configuration file

func (Systemd) StartService

func (i Systemd) StartService(h Host, s string) error

StartService starts a service

func (Systemd) StopService

func (i Systemd) StopService(h Host, s string) error

StopService stops a service

Jump to

Keyboard shortcuts

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