systemctl

package
v0.4.8-alpha26 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// `done` indicates successful execution of a job.
	ResultDone = "done"

	// `canceled` indicates that a job has been canceled before it finished execution.
	ResultCanceled = "canceled"
	ErrorCanceled  = errors.New("job has been canceled before it finished execution")

	// `timeout` indicates that the job timeout was reached.
	ResultTimeout = "timeout"
	ErrorTimeout  = errors.New("job timeout was reached")

	// `failed` indicates that the job failed.
	ResultFailed = "failed"
	ErrorFailed  = errors.New("job failed")

	// `dependency` indicates that a job this job has been depending on failed and the job hence has been removed too.
	ResultDependency = "dependency"
	ErrorDependency  = errors.New("another job this job has been depending on failed and the job hence has been removed too")

	// `skipped` indicates that a job was skipped because it didn't apply to the units current state.
	ResultSkipped = "skipped"
	ErrorSkipped  = errors.New("job was skipped because it didn't apply to the units current state")

	ErrorMap = map[string]error{
		ResultDone:       nil,
		ResultCanceled:   ErrorCanceled,
		ResultTimeout:    ErrorTimeout,
		ResultFailed:     ErrorFailed,
		ResultDependency: ErrorDependency,
		ResultSkipped:    ErrorSkipped,
	}

	ErrorUnknown = errors.New("unknown error")
)

Functions

func DisableService

func DisableService(name string) error

func EnableService

func EnableService(nameOrPath string) error

func IsServiceEnabled

func IsServiceEnabled(name string) (bool, error)

func IsServiceRunning

func IsServiceRunning(name string) (bool, error)

func ReloadDaemon added in v0.4.0

func ReloadDaemon() error

func StartService added in v0.4.0

func StartService(name string) error

func StopService added in v0.4.0

func StopService(name string) error

Types

type Service added in v0.4.2

type Service struct {
	Name    string
	Running bool
}

func ListServices added in v0.4.2

func ListServices(pattern string) ([]Service, error)

Jump to

Keyboard shortcuts

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