process

package
v0.0.0-...-7cf2d9c Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Zlib Imports: 17 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 ConfigEntry

type ConfigEntry struct {
	ConfigDir string
	Name      string
	Arguments []string
	KeyValues map[string]string
	Envs      map[string]string
}

func (*ConfigEntry) GetArgs

func (c *ConfigEntry) GetArgs() []string

func (*ConfigEntry) GetBool

func (c *ConfigEntry) GetBool(key string, defValue bool) bool

get value of key as bool

func (*ConfigEntry) GetBytes

func (c *ConfigEntry) GetBytes(key string, defValue int) int

get the value of key as the bytes setting.

logSize=1MB
logSize=1GB
logSize=1KB
logSize=1024

func (*ConfigEntry) GetEnv

func (c *ConfigEntry) GetEnv() []string

func (*ConfigEntry) GetInt

func (c *ConfigEntry) GetInt(key string, defValue int) int

get the value of the key as int

func (*ConfigEntry) GetString

func (c *ConfigEntry) GetString(key string, defValue string) string

get the value of key as string

func (*ConfigEntry) GetStringArray

func (c *ConfigEntry) GetStringArray(key string, sep string) []string

func (*ConfigEntry) HasParameter

func (c *ConfigEntry) HasParameter(key string) bool

check if has parameter

func (*ConfigEntry) String

func (c *ConfigEntry) String() string

dump the configuration as string

type Process

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

func NewProcess

func NewProcess(config *ConfigEntry) *Process

func (*Process) Attach

func (p *Process) Attach() error

func (*Process) GetDescription

func (p *Process) GetDescription() string

func (*Process) GetExitstatus

func (p *Process) GetExitstatus() int

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) error

func (*Process) Start

func (p *Process) Start(wait bool)

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) Clear

func (pm *ProcessManager) Clear()

clear all the processes

func (*ProcessManager) CreateProcess

func (pm *ProcessManager) CreateProcess(config *ConfigEntry) *Process

func (*ProcessManager) Find

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

return process if found or nil if not found

func (*ProcessManager) ForEachProcess

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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