service

package
v0.0.0-...-08417ef Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetByName

func GetByName(name string) (s *mgr.Service, err error)

GetByName returns a mgr.Sevive given a service name returned mgr.Service object has to be closed to release resources.

func Install

func Install(name, desc, startType string, args ...string) error

Install creates a service - startType can be one of: "auto", "manual" or "disabled"

func Remove

func Remove(name string) error

Remove removes service by name

func Run

func Run(name string, args ...string)

Run starts executing the program

Types

type Wrapper

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

Wrapper implements the svc.Handler interface, and wraps an executable allowing it to run as a service

func NewWrapper

func NewWrapper(exeName string, args []string) *Wrapper

NewWrapper returns a Wrapper

func (*Wrapper) Execute

func (w *Wrapper) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32)

Execute will be called by the package code at the start of the service, and the service will exit once Execute completes. Inside Execute you must read service change requests from r and act accordingly. You must keep service control manager up to date about state of your service by writing into s as required. args contains service name followed by argument strings passed to the service. You can provide service exit code in exitCode return parameter, with 0 being "no error". You can also indicate if exit code, if any, is service specific or not by using svcSpecificEC parameter.

func (Wrapper) GetCommand

func (w Wrapper) GetCommand() []string

GetCommand returns a slice of command+args

Jump to

Keyboard shortcuts

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