Documentation ¶
Overview ¶
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.
Index ¶
- Constants
- type Config
- type Mgr
- type Service
- func (s *Service) Close() error
- func (s *Service) Config() (Config, error)
- func (s *Service) Control(c svc.Cmd) (svc.Status, error)
- func (s *Service) Delete() error
- func (s *Service) Query() (svc.Status, error)
- func (s *Service) Start(args ...string) error
- func (s *Service) UpdateConfig(c Config) error
Constants ¶
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 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
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 }
type Mgr ¶
Mgr is used to manage Windows service.
func ConnectRemote ¶
ConnectRemote establishes a connection to the service control manager on computer named host.
func (*Mgr) CreateService ¶
CreateService installs new service name on the system. The service will be executed by running exepath binary. Use config c to specify service parameters. Any args will be passed as command-line arguments when the service is started; these arguments are distinct from the arguments passed to Service.Start or via the "Start parameters" field in the service's Properties dialog box.
func (*Mgr) Disconnect ¶
Disconnect closes connection to the service control manager m.
func (*Mgr) ListServices ¶
ListServices enumerates services in the specified service control manager database m. If the caller does not have the SERVICE_QUERY_STATUS access right to a service, the service is silently omitted from the list of services returned.
type Service ¶
Service is used to access Windows service.
func (*Service) Delete ¶
Delete marks service s for deletion from the service control manager database.
func (*Service) UpdateConfig ¶
UpdateConfig updates service s configuration parameters.