Documentation ¶
Index ¶
- Variables
- func IsRunning() (bool, error)
- func ListCommand() string
- func ListServices() ([]string, error)
- type Service
- func (s *Service) Conf() common.Conf
- func (s *Service) Exists() (bool, error)
- func (s *Service) Install() error
- func (s *Service) InstallCommands() ([]string, error)
- func (s *Service) Installed() (bool, error)
- func (s *Service) Name() string
- func (s *Service) Remove() error
- func (s *Service) Running() (bool, error)
- func (s *Service) Start() error
- func (s *Service) StartCommands() ([]string, error)
- func (s *Service) Stop() error
- func (s *Service) Validate() error
- type ServiceManager
- type SvcManager
- func (s *SvcManager) ChangeServicePassword(name, newPassword string) error
- func (s *SvcManager) Create(name string, conf common.Conf) error
- func (s *SvcManager) Delete(name string) error
- func (s *SvcManager) Exists(name string, conf common.Conf) (bool, error)
- func (s *SvcManager) Running(name string) (bool, error)
- func (s *SvcManager) Start(name string) error
- func (s *SvcManager) Stop(name string) error
Constants ¶
This section is empty.
Variables ¶
var NewServiceManager = func() (ServiceManager, error) { return &SvcManager{}, nil }
Functions ¶
func ListCommand ¶
func ListCommand() string
ListCommand returns a command that will list the services on a host.
func ListServices ¶
ListServices returns the name of all installed services on the local host.
Types ¶
type Service ¶
Service represents a service running on the current system
func NewService ¶
NewService returns a new Service type
func (*Service) Exists ¶
Exists returns whether the service configuration reflects the desired state
func (*Service) InstallCommands ¶
InstallCommands returns shell commands to install the service.
func (*Service) StartCommands ¶
StartCommands returns shell commands to start the service.
type ServiceManager ¶
type ServiceManager interface { // Start starts a service. Start(name string) error // Stop stops a service. Stop(name string) error // Delete deletes a service. Delete(name string) error // Create creates a service with the given config. Create(name string, conf common.Conf) error // Running returns the status of a service. Running(name string) (bool, error) // Exists checks whether the config of the installed service matches the // config supplied to this function Exists(name string, conf common.Conf) (bool, error) // ChangeServicePassword can change the password of a service // as long as it belongs to the user defined in this package ChangeServicePassword(name, newPassword string) error }
ServiceManager exposes methods needed to manage a windows service
type SvcManager ¶
type SvcManager struct{}
SvcManager implements ServiceManager interface
func (*SvcManager) ChangeServicePassword ¶
func (s *SvcManager) ChangeServicePassword(name, newPassword string) error
ChangeServicePassword can change the password of a service as long as it belongs to the user defined in this package
func (*SvcManager) Create ¶
func (s *SvcManager) Create(name string, conf common.Conf) error
Create creates a service with the given config.
func (*SvcManager) Delete ¶
func (s *SvcManager) Delete(name string) error
Delete deletes a service.
func (*SvcManager) Exists ¶
Exists checks whether the config of the installed service matches the config supplied to this function