process

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STOPPED  ProcessState = iota
	STARTING              = 10
	RUNNING               = 20
	BACKOFF               = 30
	STOPPING              = 40
	EXITED                = 100
	FATAL                 = 200
	UNKNOWN               = 1000
)

Variables

This section is empty.

Functions

func Path_expand

func Path_expand(path string) (string, error)

Types

type Process

type Process struct {
	StdoutLog logger.Logger
	StderrLog logger.Logger
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(supervisor_id string, config *config.ConfigEntry) *Process

func (*Process) GetDescription

func (p *Process) GetDescription() string

func (*Process) GetExitstatus

func (p *Process) GetExitstatus() int

func (*Process) GetGroup

func (p *Process) GetGroup() string

func (*Process) GetName

func (p *Process) GetName() string

func (*Process) GetPid

func (p *Process) GetPid() int

func (*Process) GetPriority

func (p *Process) GetPriority() int

func (*Process) GetStartTime

func (p *Process) GetStartTime() time.Time

func (*Process) GetState

func (p *Process) GetState() ProcessState

Get the process state

func (*Process) GetStatus

func (p *Process) GetStatus() string

func (*Process) GetStderrLogfile

func (p *Process) GetStderrLogfile() string

func (*Process) GetStdoutLogfile

func (p *Process) GetStdoutLogfile() string

func (*Process) GetStopTime

func (p *Process) GetStopTime() time.Time

func (*Process) SendProcessStdin

func (p *Process) SendProcessStdin(chars string) error

func (*Process) Signal

func (p *Process) Signal(sig os.Signal, sigChildren bool) error

send signal to the process

Args:

sig - the signal to the process
sigChildren - true: send the signal to the process and its children proess

func (*Process) Start

func (p *Process) Start(wait bool)

start the process Args:

wait - true, wait the program started or failed

func (*Process) Stop

func (p *Process) Stop(wait bool)

send signal to process to stop it

type ProcessManager

type ProcessManager struct {
	// contains filtered or unexported fields
}

func NewProcessManager

func NewProcessManager() *ProcessManager

func (*ProcessManager) Add

func (pm *ProcessManager) Add(name string, proc *Process)

func (*ProcessManager) AsyncForEachProcess

func (pm *ProcessManager) AsyncForEachProcess(procFunc func(p *Process), done chan *Process) int

handle each process in async mode Args: - procFunc, the function to handle the process - done, signal the process is completed Returns: number of total processes

func (*ProcessManager) Clear

func (pm *ProcessManager) Clear()

clear all the processes

func (*ProcessManager) CreateProcess

func (pm *ProcessManager) CreateProcess(supervisor_id string, config *config.ConfigEntry) *Process

func (*ProcessManager) Find

func (pm *ProcessManager) Find(name string) *Process

return process if found or nil if not found

func (*ProcessManager) FindMatch

func (pm *ProcessManager) FindMatch(name string) []*Process

func (*ProcessManager) ForEachProcess

func (pm *ProcessManager) ForEachProcess(procFunc func(p *Process))

process each process in sync mode

func (*ProcessManager) Remove

func (pm *ProcessManager) Remove(name string) *Process

remove the process from the manager

Arguments: name - the name of program

Return the process or nil

func (*ProcessManager) StartAutoStartPrograms

func (pm *ProcessManager) StartAutoStartPrograms()

func (*ProcessManager) StopAllProcesses

func (pm *ProcessManager) StopAllProcesses()

type ProcessState

type ProcessState int

func (ProcessState) String

func (p ProcessState) String() string

Jump to

Keyboard shortcuts

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