daemon

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: Zlib Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KStatusRunning = Status(1)
	KStatusClose   = Status(2)
	KStatusExit    = Status(3)
)

Variables

View Source
var (
	DefConfig = Config{Config: system.Config{EnableEnv: true, EnableStd: false}}

	CmdNilErr   = errors.New("cmd obj is nil")
	MaxCountErr = errors.New("max count")
	MaxErr      = errors.New("max error")
)

Functions

func Group added in v0.8.3

func Group(group int, args []string, cb ProcessCallback, config Config, opts ...ArgOptionFunc)

Group 守护进程启动一个N[1,2000]子进程, 并循环监视

func Run

func Run(groupId int, args []string, cb ProcessCallback, config Config, opts ...ArgOptionFunc) int

Run 守护进程启动一个子进程, 并循环监视

Types

type ArgOption added in v1.0.66

type ArgOption struct {
	Id   int
	Data interface{} //用户自己定义
	Args []string
	Env  []string
}

type ArgOptionFunc added in v1.0.66

type ArgOptionFunc func(arg *ArgOption)

type Cmd added in v1.1.0

type Cmd struct {
	Cmd  *exec.Cmd
	Err  error
	Data interface{}
}

func Background

func Background(id int, args []string, conf Config, opts ...ArgOptionFunc) (*Cmd, error)

func (*Cmd) WithErr added in v1.1.0

func (c *Cmd) WithErr(err error) *Cmd

type Config

type Config struct {
	system.Config
	MaxCount    int   `json:"maxCount" yaml:"maxCount" xml:"maxCount"`
	MaxError    int   `json:"maxError" yaml:"maxError" xml:"maxError"`
	MinExitTime int64 `json:"minExitTime" yaml:"minExitTime" xml:"minExitTime"`
}

type ProcessCallback

type ProcessCallback func(cmd *Cmd, status Status, time int64)

type Status added in v1.1.0

type Status int

Jump to

Keyboard shortcuts

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