service

package
v0.0.0-...-6f6a9a1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetNice

func SetNice() error

Types

type Logger

type Logger struct {
	EnableDebug bool
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(name string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(format string, v ...any)

func (*Logger) Error

func (l *Logger) Error(format string, v ...any)

func (*Logger) Info

func (l *Logger) Info(format string, v ...any)

func (*Logger) Warn

func (l *Logger) Warn(format string, v ...any)

type Service

type Service struct {
	Name   string
	Logger *Logger
	// contains filtered or unexported fields
}

func NewService

func NewService(args ServiceArgs) (*Service, error)

func (*Service) Pid

func (s *Service) Pid() (int, error)

Return the process ID of the current running service daemon.

func (*Service) Restart

func (s *Service) Restart() error

func (*Service) Running

func (s *Service) Running() bool

Returns true if the service is running.

func (*Service) ServiceHandler

func (s *Service) ServiceHandler(cmd *string)

func (*Service) Start

func (s *Service) Start() error

Start a new service daemon in the background.

func (*Service) Stop

func (s *Service) Stop() error

Stop the service daemon.

type ServiceArgs

type ServiceArgs struct {
	Name     string
	Logger   *Logger
	Entry    ServiceEntry
	NoDaemon bool
}

type ServiceEntry

type ServiceEntry func() (func() error, error)

Jump to

Keyboard shortcuts

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