service

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNameFieldRequired is returned when Config.Name is empty.
	ErrNameFieldRequired = errors.New("缺失配置文件")
	// ErrNoServiceSystemDetected is returned when no system was detected.
	ErrNoServiceSystemDetected = errors.New("未检测到服务系统")
	// ErrNotInstalled is returned when the service is not installed.
	ErrNotInstalled = errors.New("服务未安装")
	ErrNotSuport    = errors.New("服务不支持")
)

Functions

func NewService

func NewService(i Interface, name string) (*systemd, error)

func ServiceInstall

func ServiceInstall(svcName, execPath, dispalyName, serviceStartName, pwd string, args ...string) error

func ServiceProcessId

func ServiceProcessId(srcName string) (uint32, error)

func ServiceStart

func ServiceStart(srcName string) error

func ServiceStop

func ServiceStop(srcName string) error

func ServiceUninstall

func ServiceUninstall(srcName string) error

Types

type Interface

type Interface interface {
	Start() error
	Stop() error
}

type Status

type Status byte

Status represents service status as an byte value

const (
	StatusUnknown Status = iota // Status is unable to be determined due to an error or it was not installed.
	StatusRunning
	StatusStopped
	StatusUninstall
)

Status of service represented as an byte

func ServiceStatus

func ServiceStatus(srcName string) (Status, error)

status

Directories

Path Synopsis
example
cli

Jump to

Keyboard shortcuts

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