daemon

package
v0.0.0-...-93b0e25 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ENV_NAME = "XW_DAEMON_IDX"

Variables

This section is empty.

Functions

func Background

func Background(logFile string) error

*

  • @description: 转为后台运行
  • @param {string} logFile 若不为空,子程序的标准输出和错误输出将记入此文件
  • @return {error} 失败原因

func NewSysProcAttr

func NewSysProcAttr() *syscall.SysProcAttr

func Start

func Start()

Types

type Daemon

type Daemon struct {
	LogFile     string //日志文件, 记录守护进程和子进程的标准输出和错误输出. 若为空则不记录
	MaxCount    int    //循环重启最大次数, 若为0则无限重启
	MaxError    int    //连续启动失败或异常退出的最大次数, 超过此数, 守护进程退出, 不再重启子进程
	MinExitTime int64  //子进程正常退出的最小时间(秒). 小于此时间则认为是异常退出
}

守护进程

func NewDaemon

func NewDaemon(logFile string) *Daemon

func (*Daemon) Run

func (d *Daemon) Run()

启动后台守护进程

Jump to

Keyboard shortcuts

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