Documentation ¶
Overview ¶
Package initsystem provides an abstraction over several supported init systems.
Index ¶
- type Host
- type OpenRC
- func (i OpenRC) DaemonReload(_ Host) error
- func (i OpenRC) DisableService(h Host, s string) error
- func (i OpenRC) EnableService(h Host, s string) error
- func (i OpenRC) RestartService(h Host, s string) error
- func (i OpenRC) ServiceEnvironmentContent(env map[string]string) string
- func (i OpenRC) ServiceEnvironmentPath(_ Host, s string) (string, error)
- func (i OpenRC) ServiceIsRunning(h Host, s string) bool
- func (i OpenRC) ServiceScriptPath(h Host, s string) (string, error)
- func (i OpenRC) StartService(h Host, s string) error
- func (i OpenRC) StopService(h Host, s string) error
- type Systemd
- func (i Systemd) DaemonReload(h Host) error
- func (i Systemd) DisableService(h Host, s string) error
- func (i Systemd) EnableService(h Host, s string) error
- func (i Systemd) RestartService(h Host, s string) error
- func (i Systemd) ServiceEnvironmentContent(env map[string]string) string
- func (i Systemd) ServiceEnvironmentPath(h Host, s string) (string, error)
- func (i Systemd) ServiceIsRunning(h Host, s string) bool
- func (i Systemd) ServiceScriptPath(h Host, s string) (string, error)
- func (i Systemd) StartService(h Host, s string) error
- func (i Systemd) StopService(h Host, s string) error
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 ¶
DaemonReload reloads init system configuration
func (OpenRC) DisableService ¶
DisableService disables a service
func (OpenRC) EnableService ¶
EnableService enables a service
func (OpenRC) RestartService ¶
RestartService restarts a service
func (OpenRC) ServiceEnvironmentContent ¶ added in v0.3.24
ServiceEnvironmentContent returns a formatted string for a service environment override file
func (OpenRC) ServiceEnvironmentPath ¶ added in v0.3.24
ServiceEnvironmentPath returns a path to an environment override file path
func (OpenRC) ServiceIsRunning ¶
ServiceIsRunning returns true if a service is running
func (OpenRC) ServiceScriptPath ¶
ServiceScriptPath returns the path to a service configuration file
func (OpenRC) StartService ¶
StartService starts a service
type Systemd ¶
type Systemd struct{}
Systemd is found by default on most linux distributions today
func (Systemd) DaemonReload ¶
DaemonReload reloads init system configuration
func (Systemd) DisableService ¶
DisableService disables a service
func (Systemd) EnableService ¶
EnableService enables a service
func (Systemd) RestartService ¶
RestartService restarts a service
func (Systemd) ServiceEnvironmentContent ¶ added in v0.3.24
ServiceEnvironmentContent returns a formatted string for a service environment override file
func (Systemd) ServiceEnvironmentPath ¶ added in v0.3.24
ServiceEnvironmentPath returns a path to an environment override file path
func (Systemd) ServiceIsRunning ¶
ServiceIsRunning returns true if a service is running
func (Systemd) ServiceScriptPath ¶
ServiceScriptPath returns the path to a service configuration file
func (Systemd) StartService ¶
StartService starts a service