Documentation
¶
Index ¶
- Constants
- func AddConfigChangeMonitor(path string, filePattern string, ...)
- func AddProgramChangeMonitor(path string, ...)
- func NewProcCollector(mgr *Manager) *procCollector
- func PathExpand(path string) (string, error)
- type Manager
- func (pm *Manager) Add(name string, proc *Process)
- func (pm *Manager) AsyncForEachProcess(procFunc func(p *Process), done chan *Process) int
- func (pm *Manager) Clear()
- func (pm *Manager) CreateProcess(supervisorID string, config *config.Entry) *Process
- func (pm *Manager) Find(name string) *Process
- func (pm *Manager) FindMatch(name string) []*Process
- func (pm *Manager) ForEachProcess(procFunc func(p *Process))
- func (pm *Manager) Remove(name string) *Process
- func (pm *Manager) StartAutoStartPrograms()
- func (pm *Manager) StopAllProcesses()
- type Process
- func (p *Process) GetArgs() []string
- func (p *Process) GetDescription() string
- func (p *Process) GetExitstatus() int
- func (p *Process) GetGroup() string
- func (p *Process) GetName() string
- func (p *Process) GetPid() int
- func (p *Process) GetPriority() int
- func (p *Process) GetStartTime() time.Time
- func (p *Process) GetState() State
- func (p *Process) GetStatus() string
- func (p *Process) GetStderrLogfile() string
- func (p *Process) GetStdoutLogfile() string
- func (p *Process) GetStopTime() time.Time
- func (p *Process) SendProcessStdin(chars string) error
- func (p *Process) SetupArgs(args string)
- func (p *Process) Signal(sig os.Signal, sigChildren bool) error
- func (p *Process) Start(wait bool)
- func (p *Process) Stop(wait bool)
- type State
Constants ¶
const ( // Stopped the stopped state Stopped State = iota // Starting the starting state Starting = 10 // Running the running state Running = 20 // Backoff the backoff state Backoff = 30 // Stopping the stopping state Stopping = 40 // Exited the Exited state Exited = 100 // Fatal the Fatal state Fatal = 200 // Unknown the unknown state Unknown = 1000 )
Variables ¶
This section is empty.
Functions ¶
func AddConfigChangeMonitor ¶
func AddConfigChangeMonitor(path string, filePattern string, fileChangeCb func(path string, mode filechangemonitor.FileChangeMode))
AddConfigChangeMonitor add a program change listener to monitor if any one of its configuration files is changed
func AddProgramChangeMonitor ¶
func AddProgramChangeMonitor(path string, fileChangeCb func(path string, mode filechangemonitor.FileChangeMode))
AddProgramChangeMonitor add a program change listener to monitor if the program binary
func NewProcCollector ¶
func NewProcCollector(mgr *Manager) *procCollector
NewProcCollector returns a new Collector exposing supervisord statistics.
func PathExpand ¶
PathExpand replace the ~ with user home directory
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manage all the process in the supervisor
func (*Manager) AsyncForEachProcess ¶
AsyncForEachProcess 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 (*Manager) CreateProcess ¶
CreateProcess create a process (program or event listener) and add to this manager
func (*Manager) Find ¶
Find find process by program name return process if found or nil if not found
func (*Manager) FindMatch ¶
FindMatch find the program with one of following format: - group:program - group:* - program
func (*Manager) ForEachProcess ¶
ForEachProcess process each process in sync mode
func (*Manager) Remove ¶
Remove remove the process from the manager
Arguments: name - the name of program
Return the process or nil
func (*Manager) StartAutoStartPrograms ¶
func (pm *Manager) StartAutoStartPrograms()
StartAutoStartPrograms start all the program if its autostart is true
func (*Manager) StopAllProcesses ¶
func (pm *Manager) StopAllProcesses()
StopAllProcesses stop all the processes managed by this manager
type Process ¶
type Process struct {
StdoutLog logger.Logger
StderrLog logger.Logger
// contains filtered or unexported fields
}
Process the program process management data
func NewProcess ¶
NewProcess create a new Process
func (*Process) GetDescription ¶
GetDescription get the process status description
func (*Process) GetExitstatus ¶
GetExitstatus get the exit status of the process if the program exit
func (*Process) GetPriority ¶
GetPriority get the program priority
func (*Process) GetStartTime ¶
GetStartTime get the process start time
func (*Process) GetStderrLogfile ¶
GetStderrLogfile get the program stderr log file
func (*Process) GetStdoutLogfile ¶
GetStdoutLogfile get the program stdout log file
func (*Process) GetStopTime ¶
GetStopTime get the process stop time
func (*Process) SendProcessStdin ¶
SendProcessStdin send data to process stdin
func (*Process) Signal ¶
Signal send signal to the process
Args:
sig - the signal to the process sigChildren - true: send the signal to the process and its children proess