supervisor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package supervisor implements a simple process supervisor

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetachAttr

func DetachAttr(uid, gid int) *syscall.SysProcAttr

DetachAttr creates the proper syscall attributes to run the managed processes

Types

type Supervisor

type Supervisor struct {
	Name           string
	BinPath        string
	RunDir         string
	DataDir        string
	Args           []string
	PidFile        string
	UID            int
	GID            int
	TimeoutStop    time.Duration
	TimeoutRespawn time.Duration
	// For those components having env prefix convention such as ETCD_xxx, we should keep the prefix.
	KeepEnvPrefix bool
	// ProcFSPath is only used for testing
	ProcFSPath string
	// KillFunction is only used for testing
	KillFunction func(int, syscall.Signal) error
	// A function to clean some leftovers before starting or restarting the supervised process
	CleanBeforeFn func() error
	Output        io.Writer
	// contains filtered or unexported fields
}

Supervisor is dead simple and stupid process supervisor, just tries to keep the process running in a while-true loop

func (*Supervisor) GetProcess

func (s *Supervisor) GetProcess() *os.Process

GetProcess returns the last started process

func (*Supervisor) Stop

func (s *Supervisor) Stop() error

Stop stops the supervised

func (*Supervisor) Supervise

func (s *Supervisor) Supervise() error

Supervise Starts supervising the given process

Jump to

Keyboard shortcuts

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