service

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	SERVICE_STOPPED          string = "Stopped"
	SERVICE_START_PENDING    string = "Start Pending"
	SERVICE_STOP_PENDING     string = "Stop Pending"
	SERVICE_RUNNING          string = "Running"
	SERVICE_CONTINUE_PENDING string = "Continue Pending"
	SERVICE_PAUSE_PENDING    string = "Pause Pending"
	SERVICE_PAUSED           string = "Paused"
)
View Source
const (
	SERVICE_START_MODE_BOOT     string = "Boot"
	SERVICE_START_MODE_SYSTEM   string = "System"
	SERVICE_START_MODE_AUTO     string = "Auto"
	SERVICE_START_MODE_MANUAL   string = "Manual"
	SERVICE_START_MODE_DISABLED string = "Disabled"
)

Win32_Service.StartMode property values. See: https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service

Variables

This section is empty.

Functions

func WaitForWin32Service

func WaitForWin32Service(whost *host.WmiHost, serviceName string, timeout int64) error

Types

type Win32Service

type Win32Service struct {
	*cimv2.Win32_Service
}

func GetWin32Service

func GetWin32Service(whost *host.WmiHost, serviceName string) (*Win32Service, error)

func NewService

func NewService(winstance *wmi.WmiInstance) (*Win32Service, error)

func (*Win32Service) IsEnabled added in v0.43.0

func (ws *Win32Service) IsEnabled() (bool, error)

IsEnabled returns true when the service's StartMode is anything other than "Disabled". A disabled service cannot be started by the Service Control Manager, so callers that poll IsRunning should first check IsEnabled to avoid waiting on a service that will never start.

func (*Win32Service) IsRunning

func (ws *Win32Service) IsRunning() (bool, error)

Jump to

Keyboard shortcuts

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