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) Supervise ¶
func (s *Supervisor) Supervise() error
Supervise Starts supervising the given process
Click to show internal directories.
Click to hide internal directories.