daemon

package
v1.2.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DaemonLog = "daemon.log"
View Source
const EnvDaemonIdx = "XW_DAEMON_IDX"
View Source
const MaxCount = 5

Variables

This section is empty.

Functions

func Background

func Background(logFile string, priKey string, isExit bool) (*exec.Cmd, error)

Turn the the main program into background running (start a child process, and then exit) logFile - If it is not empty, the standard output and error output of the child process will be recorded in this file isExit - Whether to exit the main program directly after the child process started. If false, the main program returns * OS Process, the child process returns nil. It needs to be handled by the caller.

func NewSysProcAttr

func NewSysProcAttr() *syscall.SysProcAttr

Types

type Daemon

type Daemon struct {
	// records the standard output and error output of daemons and child processes
	LogFile string
	// The maximum number of cycle restarts. If it is 0, it will restart indefinitely
	MaxCount int
	// The maximum number of consecutive startup failures or abnormal exits.
	// Exceed this number, the daemon exits and the child process will not be restarted
	MaxError int
	// The minimum time (in seconds) for a child process to exit normally
	// Less than this time is considered as abnormal exit
	MinExitTime int64
	// validator key for daemon
	ValidatorKey string
}

Daemon

func NewDaemon

func NewDaemon(logFile string) *Daemon

func (*Daemon) Run

func (d *Daemon) Run()

Run Start the background daemon

Jump to

Keyboard shortcuts

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