process

package module
v0.0.0-...-4925ab2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 8 Imported by: 3

README

proc

Process management library.

Documentation

Index

Constants

View Source
const (
	PROCESS_STARTING = iota
	PROCESS_RUNNING
	PROCESS_RETRY
	PROCESS_EXIT_CALLED
	PROCESS_STOP_WAIT
	PROCESS_STOP
)

Variables

View Source
var (
	ProcessList  = ProcessSlice{}
	ProcessMutex sync.RWMutex
	ProcessDebug bool = true
)
View Source
var ProcessStateStr = map[int]string{
	PROCESS_STARTING:    "Starting",
	PROCESS_RUNNING:     "Running",
	PROCESS_RETRY:       "Retry",
	PROCESS_EXIT_CALLED: "Exit Called",
	PROCESS_STOP_WAIT:   "Stop Wait",
	PROCESS_STOP:        "Stop",
}

Functions

func ProcessCount

func ProcessCount() int

func ProcessListShow

func ProcessListShow() string

func ProcessRegister

func ProcessRegister(proc *Process)

func ProcessStart

func ProcessStart(index int)

func ProcessStop

func ProcessStop(index int)

func ProcessUnregister

func ProcessUnregister(proc *Process)

Types

type Process

type Process struct {
	Name        string
	Vrf         string
	Args        []string
	Env         map[string]string
	File        string
	ErrLookup   string
	ErrStart    string
	ErrWait     string
	ExitFunc    func()
	State       int
	Cmd         *exec.Cmd
	StartTimer  int
	RetryTimer  int
	Index       int
	KillPidFile string
}

func NewProcess

func NewProcess(name string, args ...string) *Process

func ProcessLookup

func ProcessLookup(index int) *Process

func (*Process) AddEnv

func (proc *Process) AddEnv(key, val string)

func (*Process) Debug

func (proc *Process) Debug(funcName string, message string)

func (*Process) DelEnv

func (proc *Process) DelEnv(key string)

func (*Process) Start

func (proc *Process) Start()

func (*Process) Stop

func (proc *Process) Stop()

type ProcessSlice

type ProcessSlice []*Process

Jump to

Keyboard shortcuts

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