service_helpers

package
v12.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotSupported is returned when specific feature is not supported.
	ErrNotSupported = errors.New("Not supported")
)

Functions

func New

func New(i service.Interface, c *service.Config) (service.Service, error)

Types

type SimpleService

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

func (*SimpleService) Install

func (s *SimpleService) Install() error

Install setups up the given service in the OS service manager. This may require greater rights. Will return an error if it is already installed.

func (*SimpleService) Logger

func (s *SimpleService) Logger(errs chan<- error) (service.Logger, error)

Logger opens and returns a system logger. If the user program is running interactively rather then as a service, the returned logger will write to os.Stderr. If errs is non-nil errors will be sent on errs as well as returned from Logger's functions.

func (*SimpleService) Restart

func (s *SimpleService) Restart() error

Restart signals to the OS service manager the given service should stop then start.

func (*SimpleService) Run

func (s *SimpleService) Run() (err error)

Run should be called shortly after the program entry point. After Interface.Stop has finished running, Run will stop blocking. After Run stops blocking, the program must exit shortly after.

func (*SimpleService) Start

func (s *SimpleService) Start() error

Start signals to the OS service manager the given service should start.

func (*SimpleService) Status

func (s *SimpleService) Status() error

Status returns nil if the given service is running. Will return an error if the service is not running or is not present.

func (*SimpleService) Stop

func (s *SimpleService) Stop() error

Stop signals to the OS service manager the given service should stop.

func (*SimpleService) String

func (s *SimpleService) String() string

String displays the name of the service. The display name if present, otherwise the name.

func (*SimpleService) SystemLogger

func (s *SimpleService) SystemLogger(errs chan<- error) (service.Logger, error)

SystemLogger opens and returns a system logger. If errs is non-nil errors will be sent on errs as well as returned from Logger's functions.

func (*SimpleService) Uninstall

func (s *SimpleService) Uninstall() error

Uninstall removes the given service from the OS service manager. This may require greater rights. Will return an error if the service is not present.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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