winsvc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package winsvc implements service management functions for the Windows Job Supervisor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStartType

func SetStartType(s *mgr.Service, startType uint32) error

func Start

func Start(s *mgr.Service) error

func Stop

func Stop(s *mgr.Service) error

Types

type Mgr

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

Mgr is used to manage Windows services.

func Connect

func Connect(match func(description string) bool) (*Mgr, error)

Connect returns a new Mgr that will monitor all services with descriptions matched by match. If match is nil all services are matched.

func (*Mgr) Delete

func (m *Mgr) Delete() error

Delete deletes the services monitored by Mgr concurrently and waits for them to be removed by the Service Control Manager. Running services are stopped before being deleted.

func (*Mgr) DisableAgentAutoStart

func (m *Mgr) DisableAgentAutoStart() error

DisableAgentAutoStart sets the start type of the bosh-agent to manual.

func (*Mgr) Disconnect

func (m *Mgr) Disconnect() error

Disconnect closes connection to the service control manager m.

func (*Mgr) Start

func (m *Mgr) Start() (first error)

Start starts all of the service monitored by Mgr.

func (*Mgr) Status

func (m *Mgr) Status() ([]ServiceStatus, error)

Status returns the name and status for all of the services monitored.

func (*Mgr) Stop

func (m *Mgr) Stop() (first error)

Stop stops all of the services monitored by Mgr concurrently and waits for the stop to complete. Stopping services with dependent services is not supported.

func (*Mgr) Unmonitor

func (m *Mgr) Unmonitor() error

Unmonitor disable start for all the Mgr m's services.

type ServiceError

type ServiceError struct {
	Op   string
	Name string
	Err  error
}

ServiceError records an error and the operation and service that caused it.

func (*ServiceError) Error

func (e *ServiceError) Error() string

type ServiceStatus

type ServiceStatus struct {
	Name  string
	State svc.State
}

A ServiceStatus is the status of a service.

func (*ServiceStatus) StateString

func (s *ServiceStatus) StateString() string

StateString returns the string representation of the service state.

type StartError

type StartError struct {
	Name   string
	Status svc.Status
}

StartError records an error that resulted from a service failing to run after a successful call to start.

func (*StartError) Error

func (e *StartError) Error() string

type TimeoutError

type TimeoutError struct {
	Timeout time.Duration
	Elapsed time.Duration
}

TimeoutError records an error from a timeout, the timeout itself and the time that elapsed before the timeout was triggered.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

type TransitionError

type TransitionError struct {
	Msg      string        // error message
	Name     string        // service name
	Status   svc.Status    // service status
	WaitHint time.Duration // calculated WaitHint
	Duration time.Duration // time elapsed waiting for the transition
}

TransitionError records an error that occurred waiting for a service to transition state and the service that caused it and it's state when the error occurred.

func (*TransitionError) Error

func (e *TransitionError) Error() string

Jump to

Keyboard shortcuts

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