windows

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewServiceManager = func() (ServiceManager, error) {
	return &SvcManager{}, nil
}

Functions

func IsRunning

func IsRunning() (bool, error)

IsRunning returns whether or not windows is the local init system.

func ListCommand

func ListCommand() string

ListCommand returns a command that will list the services on a host.

func ListServices

func ListServices() ([]string, error)

ListServices returns the name of all installed services on the local host.

Types

type Service

type Service struct {
	common.Service
	// contains filtered or unexported fields
}

Service represents a service running on the current system

func NewService

func NewService(name string, conf common.Conf) (*Service, error)

NewService returns a new Service type

func (*Service) Conf

func (s *Service) Conf() common.Conf

Conf implements service.Service.

func (*Service) Exists

func (s *Service) Exists() (bool, error)

Exists returns whether the service configuration reflects the desired state

func (*Service) Install

func (s *Service) Install() error

Install installs and starts the service.

func (*Service) InstallCommands

func (s *Service) InstallCommands() ([]string, error)

InstallCommands returns shell commands to install the service.

func (*Service) Installed

func (s *Service) Installed() (bool, error)

Installed returns whether the service is installed

func (*Service) Name

func (s *Service) Name() string

Name implements service.Service.

func (*Service) Remove

func (s *Service) Remove() error

Remove deletes the service.

func (*Service) Running

func (s *Service) Running() (bool, error)

func (*Service) Start

func (s *Service) Start() error

Start starts the service.

func (*Service) StartCommands

func (s *Service) StartCommands() ([]string, error)

StartCommands returns shell commands to start the service.

func (*Service) Stop

func (s *Service) Stop() error

Stop stops the service.

func (*Service) Validate

func (s *Service) Validate() error

Validate checks the service for invalid values.

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

func (s *SvcManager) Exists(name string, conf common.Conf) (bool, error)

Exists checks whether the config of the installed service matches the config supplied to this function

func (*SvcManager) Running

func (s *SvcManager) Running(name string) (bool, error)

Running returns the status of a service.

func (*SvcManager) Start

func (s *SvcManager) Start(name string) error

Start starts a service.

func (*SvcManager) Stop

func (s *SvcManager) Stop(name string) error

Stop stops a service.

Jump to

Keyboard shortcuts

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