Documentation ¶
Index ¶
- Variables
- func New(i service.Interface, c *service.Config) (service.Service, error)
- type SimpleService
- func (s *SimpleService) Install() error
- func (s *SimpleService) Logger(errs chan<- error) (service.Logger, error)
- func (s *SimpleService) Restart() error
- func (s *SimpleService) Run() (err error)
- func (s *SimpleService) Start() error
- func (s *SimpleService) Status() error
- func (s *SimpleService) Stop() error
- func (s *SimpleService) String() string
- func (s *SimpleService) SystemLogger(errs chan<- error) (service.Logger, error)
- func (s *SimpleService) Uninstall() error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupported is returned when specific feature is not supported. ErrNotSupported = errors.New("Not supported.") )
Functions ¶
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.