service

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: AGPL-3.0 Imports: 10 Imported by: 2

README

Go Reference

service

Service is yet another library to allow services to interface with systemd. You probably want to use other libraries to achieve that since I created this one specialized for my use cases.

This project is released under GNU Affero General Public License v3.0, see LICENCE file in this repo for more info.

Documentation

Overview

Package service handles interfacing with systemd.

Index

Constants

This section is empty.

Variables

View Source
var ErrEnvMissing = errors.New("env var unset")

ErrEnvMissing indicates a required environment variable is not set.

Functions

func LoadCred added in v0.0.7

func LoadCred(dir, name string) ([]byte, error)

LoadCred loads a credential file.

func UnmarshalYAMLCred added in v0.0.7

func UnmarshalYAMLCred(dir, name string, dst interface{}) error

UnmarshalYAMLCred unmarshals the YAML credential file called name into dst.

Types

type Service

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

Service allows interfacing with systemd.

func New

func New() (*Service, error)

New creates a new Service instance to interface with systemd.

func (Service) CredPath added in v0.0.5

func (s Service) CredPath(name string) string

CredPath returns the path credentials that contains systemd credentials.

func (Service) Journal

func (s Service) Journal() logr.Logger

Journal returns a logr.Logger that writes structured logs to the systemd journal.

func (Service) Listeners

func (s Service) Listeners() []net.Listener

Listeners returns listeners passed by systemd via socket activation.

func (Service) LoadCred added in v0.0.7

func (s Service) LoadCred(name string) ([]byte, error)

LoadCred loads a credential file.

func (Service) MarkReady

func (s Service) MarkReady() error

MarkReady tells systemd that this service is ready and running.

func (Service) MarkStatus

func (s Service) MarkStatus(status string) error

MarkStatus tells systemd that this service has the given status.

func (Service) MarkStopping

func (s Service) MarkStopping() error

MarkStopping tells systemd that this service is about to stop.

func (Service) RunNotify added in v0.0.3

func (s Service) RunNotify(ctx context.Context) error

RunNotify marks the service as running, blocks until the given context is cancelled and then marks the service as shutting down.

func (Service) RuntimeDirectory added in v0.0.5

func (s Service) RuntimeDirectory() string

RuntimeDirectory is the runtime directory set by systemd. Panics if not set by systemd.

func (Service) StateDirectory added in v0.0.5

func (s Service) StateDirectory() string

StateDirectory is the state directory set by systemd. Panics if not set by systemd.

func (Service) UnmarshalYAMLCred added in v0.0.7

func (s Service) UnmarshalYAMLCred(name string, dst interface{}) error

UnmarshalYAMLCred unmarshals the YAML credential file called name into dst.

Directories

Path Synopsis
cmd
mage
Package main contains the entry point for mage.
Package main contains the entry point for mage.
Package socket handles the socket activation of systemd.
Package socket handles the socket activation of systemd.

Jump to

Keyboard shortcuts

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