import "golang.org/x/sys/windows/svc/mgr"
Package mgr can be used to manage Windows service programs. It can be used to install and remove them. It can also start, stop and pause them. The package can query / change current service state and config parameters.
const (
// Service start types.
StartManual = windows.SERVICE_DEMAND_START // the service must be started manually
StartAutomatic = windows.SERVICE_AUTO_START // the service will start by itself whenever the computer reboots
StartDisabled = windows.SERVICE_DISABLED // the service cannot be started
// The severity of the error, and action taken,
// if this service fails to start.
ErrorCritical = windows.SERVICE_ERROR_CRITICAL
ErrorIgnore = windows.SERVICE_ERROR_IGNORE
ErrorNormal = windows.SERVICE_ERROR_NORMAL
ErrorSevere = windows.SERVICE_ERROR_SEVERE
)type Config struct {
ServiceType uint32
StartType uint32
ErrorControl uint32
BinaryPathName string // fully qualified path to the service binary file, can also include arguments for an auto-start service
LoadOrderGroup string
TagId uint32
Dependencies []string
ServiceStartName string // name of the account under which the service should run
DisplayName string
Password string
Description string
}Mgr is used to manage Windows service.
Connect establishes a connection to the service control manager.
ConnectRemote establishes a connection to the service control manager on computer named host.
CreateService installs new service name on the system. The service will be executed by running exepath binary. Use config c to specify service parameters. If service StartType is set to StartAutomatic, args will be passed to svc.Handle.Execute.
Disconnect closes connection to the service control manager m.
OpenService retrieves access to service name, so it can be interrogated and controlled.
Service is used to access Windows service.
Close relinquish access to the service s.
Config retrieves service s configuration paramteres.
Control sends state change request c to the servce s.
Delete marks service s for deletion from the service control manager database.
Query returns current status of service s.
Start starts service s. args will be passed to svc.Handler.Execute.
UpdateConfig updates service s configuration parameters.
Package mgr imports 5 packages (graph) and is imported by 4 packages. Updated 5 days ago with GOOS=windows. Refresh now. Tools for package owners.