sysinit

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package sysinit provides an abstraction over init systems like systemctl

Package sysinit provides an abstraction over init systems like systemctl

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Name returns the name of the init manager
	Name() string

	// Active returns if a service is active
	Active(string) bool

	// Disable disables a service
	Disable(string) error

	// Enable enables a service
	Enable(string) error

	// Start starts a service idempotently
	Start(string) error

	// Restart restarts a service
	Restart(string) error

	// Stop stops a service
	Stop(string) error

	// ForceStop stops a service with prejudice
	ForceStop(string) error

	// GenerateInitShim generates any additional init files required for this service
	GenerateInitShim(svc string, binary string, unit string) ([]assets.CopyableFile, error)
}

Manager is a common interface for init systems

func New

func New(r Runner) Manager

New returns an appropriately configured service manager

type OpenRC

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

OpenRC is a service manager for OpenRC-like init systems

func (*OpenRC) Active

func (s *OpenRC) Active(svc string) bool

Active checks if a service is running

func (*OpenRC) Disable

func (s *OpenRC) Disable(svc string) error

Disable does nothing

func (*OpenRC) Enable

func (s *OpenRC) Enable(svc string) error

Enable does nothing

func (*OpenRC) ForceStop

func (s *OpenRC) ForceStop(svc string) error

ForceStop stops a service with prejuidice

func (*OpenRC) GenerateInitShim

func (s *OpenRC) GenerateInitShim(svc string, binary string, unit string) ([]assets.CopyableFile, error)

GenerateInitShim generates any additional init files required for this service

func (*OpenRC) Name

func (s *OpenRC) Name() string

Name returns the name of the init system

func (*OpenRC) Restart

func (s *OpenRC) Restart(svc string) error

Restart restarts a service

func (*OpenRC) Start

func (s *OpenRC) Start(svc string) error

Start starts a service idempotently

func (*OpenRC) Stop

func (s *OpenRC) Stop(svc string) error

Stop stops a service

type Runner

type Runner interface {
	RunCmd(cmd *exec.Cmd) (*command.RunResult, error)
}

Runner is the subset of command.Runner this package consumes

type Systemd

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

Systemd is a service manager for systemd distributions

func (*Systemd) Active

func (s *Systemd) Active(svc string) bool

Active checks if a service is running

func (*Systemd) Disable

func (s *Systemd) Disable(svc string) error

Disable disables a service

func (*Systemd) Enable

func (s *Systemd) Enable(svc string) error

Enable enables a service

func (*Systemd) ForceStop

func (s *Systemd) ForceStop(svc string) error

ForceStop terminates a service with prejudice

func (*Systemd) GenerateInitShim

func (s *Systemd) GenerateInitShim(svc string, binary string, unit string) ([]assets.CopyableFile, error)

GenerateInitShim does nothing for systemd

func (*Systemd) Name

func (s *Systemd) Name() string

Name returns the name of the init system

func (*Systemd) Restart

func (s *Systemd) Restart(svc string) error

Restart restarts a service

func (*Systemd) Start

func (s *Systemd) Start(svc string) error

Start starts a service

func (*Systemd) Stop

func (s *Systemd) Stop(svc string) error

Stop stops a service

Jump to

Keyboard shortcuts

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